@seaveyon/harness-switch 0.4.0 → 0.5.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 +3 -3
- package/dist/harness-switch.js +137 -66
- package/package.json +4 -3
- package/public/assets/1044.39aafe87.js +1 -0
- package/public/assets/1045.21280f56.js +1 -0
- package/public/assets/1050.46b86852.js +1 -0
- package/public/assets/1064.d2226313.js +1 -0
- package/public/assets/109.d185b844.js +1 -0
- package/public/assets/117.fbce1498.js +1 -0
- package/public/assets/1216.f58f116a.js +1 -0
- package/public/assets/1266.b0b77ece.js +1 -0
- package/public/assets/1274.36c97e4b.js +1 -0
- package/public/assets/1284.6d1b1fa9.js +1 -0
- package/public/assets/1297.5aa40a92.js +1 -0
- package/public/assets/1337.91282e33.js +1 -0
- package/public/assets/1348.3156645b.js +1 -0
- package/public/assets/1446.08d331b6.js +1 -0
- package/public/assets/1473.b0f70164.js +1 -0
- package/public/assets/1495.98d34a19.js +1 -0
- package/public/assets/1498.a7a38ca7.js +1 -0
- package/public/assets/1506.50339f62.js +1 -0
- package/public/assets/1541.3def363d.js +1 -0
- package/public/assets/1558.a7617461.js +1 -0
- package/public/assets/1565.2f21c8e1.js +1 -0
- package/public/assets/1680.4e882493.js +1 -0
- package/public/assets/1706.b445c403.js +1 -0
- package/public/assets/1811.132227bb.js +1 -0
- package/public/assets/1822.9d44e9b8.js +1 -0
- package/public/assets/1852.561dcf77.js +1 -0
- package/public/assets/1875.f9da64a1.js +1 -0
- package/public/assets/193.86e5680f.js +1 -0
- package/public/assets/1942.edb657de.js +1 -0
- package/public/assets/197.be0123ad.js +1 -0
- package/public/assets/1972.b1548051.js +1 -0
- package/public/assets/198.2702464a.js +1 -0
- package/public/assets/1981.4e7751ba.js +1 -0
- package/public/assets/2048.e0b5be0d.js +1 -0
- package/public/assets/2067.6433a4bd.js +1 -0
- package/public/assets/2082.b2643ed0.js +1 -0
- package/public/assets/2185.248c6b44.js +1 -0
- package/public/assets/2202.e80e4d18.js +1 -0
- package/public/assets/2227.cf7e7a88.js +1 -0
- package/public/assets/2234.f03ed50e.js +1 -0
- package/public/assets/2247.8cd63431.js +1 -0
- package/public/assets/2301.5b08aa31.js +1 -0
- package/public/assets/231.073ec786.js +1 -0
- package/public/assets/233.9eea8428.js +1 -0
- package/public/assets/2332.bec77738.js +1 -0
- package/public/assets/234.e1ec501c.js +1 -0
- package/public/assets/2368.6d60e76e.js +1 -0
- package/public/assets/2378.a09f27ac.js +1 -0
- package/public/assets/2411.1a1e84d8.js +1 -0
- package/public/assets/2426.12abe760.js +1 -0
- package/public/assets/2536.d03279a1.js +1 -0
- package/public/assets/2605.3ae8a730.js +1 -0
- package/public/assets/2645.52e9596b.js +1 -0
- package/public/assets/2707.6df3e122.js +1 -0
- package/public/assets/2725.9a21dc87.js +1 -0
- package/public/assets/2743.d8ff9d1a.js +1 -0
- package/public/assets/2748.a74a539c.js +1 -0
- package/public/assets/2751.3761b15d.js +1 -0
- package/public/assets/278.06c0a585.js +1 -0
- package/public/assets/2810.0805c8d3.js +1 -0
- package/public/assets/2816.52f328bf.js +1 -0
- package/public/assets/2872.712f11ad.js +1 -0
- package/public/assets/2881.812773b3.js +1 -0
- package/public/assets/2895.412a0fef.js +1 -0
- package/public/assets/2918.ca9f8ee6.js +1 -0
- package/public/assets/2948.812bfd61.js +1 -0
- package/public/assets/3008.0e0072bf.js +1 -0
- package/public/assets/3084.812f46dd.js +1 -0
- package/public/assets/311.ff658c78.js +1 -0
- package/public/assets/3115.de6d897d.js +1 -0
- package/public/assets/312.6893cc70.js +1 -0
- package/public/assets/3121.abf15015.js +1 -0
- package/public/assets/3123.bb6961b4.js +1 -0
- package/public/assets/3168.f70fdbe1.js +1 -0
- package/public/assets/3260.b9830b0a.js +1 -0
- package/public/assets/331.5979e79c.js +1 -0
- package/public/assets/3323.33607bff.js +1 -0
- package/public/assets/333.62f29c23.js +1 -0
- package/public/assets/3339.55ba3289.js +1 -0
- package/public/assets/3370.ac044cd4.js +1 -0
- package/public/assets/3381.ebf520a0.js +1 -0
- package/public/assets/3384.97088998.js +1 -0
- package/public/assets/3420.d26395e2.js +1 -0
- package/public/assets/3432.9a6cbc9d.js +1 -0
- package/public/assets/3474.c3b0a117.js +1 -0
- package/public/assets/3502.713d8997.js +1 -0
- package/public/assets/3520.8332b3b9.js +1 -0
- package/public/assets/3663.7e96a229.js +1 -0
- package/public/assets/3707.9a1cc57e.js +1 -0
- package/public/assets/3712.ccdacc8b.js +1 -0
- package/public/assets/3724.c7124c16.js +1 -0
- package/public/assets/379.3eba2174.js +1 -0
- package/public/assets/3793.2f8f8fa2.js +1 -0
- package/public/assets/3808.61543a59.js +1 -0
- package/public/assets/3809.ea90d219.js +1 -0
- package/public/assets/382.df49ab73.js +1 -0
- package/public/assets/3844.ad345570.js +1 -0
- package/public/assets/3853.0041121c.js +1 -0
- package/public/assets/3886.4758be08.js +1 -0
- package/public/assets/3911.67d83e56.js +1 -0
- package/public/assets/3945.02b410f7.js +1 -0
- package/public/assets/4025.faefbdf9.js +1 -0
- package/public/assets/4049.274b3781.js +1 -0
- package/public/assets/4058.9bd8b6fd.js +1 -0
- package/public/assets/4087.f5f2aa77.js +1 -0
- package/public/assets/4145.591efba1.js +1 -0
- package/public/assets/4179.0e70c02d.js +1 -0
- package/public/assets/4261.24d2c946.js +1 -0
- package/public/assets/4301.d36b09ac.js +1 -0
- package/public/assets/438.c9ddabb1.js +1 -0
- package/public/assets/4405.195b8807.js +1 -0
- package/public/assets/4429.20a43aee.js +1 -0
- package/public/assets/4445.0593f53c.js +1 -0
- package/public/assets/4447.1f4c2594.js +1 -0
- package/public/assets/4458.b54836f5.js +1 -0
- package/public/assets/4489.e05c3f02.js +1 -0
- package/public/assets/4496.59f9e494.js +1 -0
- package/public/assets/4498.53895790.js +1 -0
- package/public/assets/452.bf34842d.js +1 -0
- package/public/assets/4525.202e71f0.js +1 -0
- package/public/assets/459.d0de752e.js +1 -0
- package/public/assets/4609.539adc7e.js +1 -0
- package/public/assets/4613.2c9412fc.js +1 -0
- package/public/assets/465.6d0c9900.js +1 -0
- package/public/assets/4655.817d8c16.js +1 -0
- package/public/assets/4704.5bd5cd1f.js +1 -0
- package/public/assets/4705.1b7400d1.js +1 -0
- package/public/assets/4785.2c122907.js +1 -0
- package/public/assets/4795.5b28b5a2.js +1 -0
- package/public/assets/4796.38fc127d.js +1 -0
- package/public/assets/4798.061be689.js +1 -0
- package/public/assets/4846.2f6655eb.js +1 -0
- package/public/assets/485.3fe4cb47.js +1 -0
- package/public/assets/4885.c0812b9f.js +1 -0
- package/public/assets/4952.5b132c3d.js +1 -0
- package/public/assets/4983.565b5198.js +1 -0
- package/public/assets/4992.abfa216e.js +1 -0
- package/public/assets/4994.5eac32c7.js +1 -0
- package/public/assets/4996.46cad67b.js +1 -0
- package/public/assets/5068.3fa2fa23.js +1 -0
- package/public/assets/5072.7adfff93.js +1 -0
- package/public/assets/5108.62165adf.js +1 -0
- package/public/assets/5280.bc09c97b.js +1 -0
- package/public/assets/5281.73e94011.js +1 -0
- package/public/assets/5294.b2f2f0bd.js +1 -0
- package/public/assets/5319.e6dcabf9.js +1 -0
- package/public/assets/5393.e6c80ec4.js +1 -0
- package/public/assets/5398.d0384b7e.js +1 -0
- package/public/assets/5415.c896e0e1.js +1 -0
- package/public/assets/544.64addbc4.js +1 -0
- package/public/assets/5453.08deb63c.js +1 -0
- package/public/assets/5458.0095414b.js +1 -0
- package/public/assets/5462.17536a21.js +1 -0
- package/public/assets/5466.7acd94a7.js +1 -0
- package/public/assets/5518.57996485.js +1 -0
- package/public/assets/5530.828452d4.js +1 -0
- package/public/assets/5542.9162530c.js +1 -0
- package/public/assets/5593.0776f2d3.js +1 -0
- package/public/assets/5596.8a7ddea5.js +1 -0
- package/public/assets/5631.f6c57eaf.js +1 -0
- package/public/assets/5646.a72b2c1e.js +1 -0
- package/public/assets/5661.164c0709.js +1 -0
- package/public/assets/5678.c096f6c9.js +1 -0
- package/public/assets/5687.587f0e75.js +1 -0
- package/public/assets/5703.5e666028.js +1 -0
- package/public/assets/5708.164057e0.js +1 -0
- package/public/assets/5712.cc503220.js +1 -0
- package/public/assets/575.e898fd86.js +1 -0
- package/public/assets/5752.e018032d.js +1 -0
- package/public/assets/5813.cc59df28.js +1 -0
- package/public/assets/5865.012fa536.js +1 -0
- package/public/assets/5879.47b8e3c2.js +1 -0
- package/public/assets/590.8c02fbf9.js +1 -0
- package/public/assets/5917.87e0acee.js +1 -0
- package/public/assets/5959.c0de70a1.js +1 -0
- package/public/assets/5970.31600f7b.js +1 -0
- package/public/assets/6005.fb7dbdae.js +1 -0
- package/public/assets/6024.c3f22f35.js +1 -0
- package/public/assets/6070.6f66b5fa.js +1 -0
- package/public/assets/6084.26b44499.js +1 -0
- package/public/assets/6085.cb855236.js +1 -0
- package/public/assets/6093.bebbe3da.js +1 -0
- package/public/assets/6106.39b87fca.js +1 -0
- package/public/assets/6122.f064356d.js +1 -0
- package/public/assets/6150.910aaed9.js +203 -0
- package/public/assets/6157.7eeb3515.js +1 -0
- package/public/assets/616.a5acd2aa.js +1 -0
- package/public/assets/6226.dd8f1fd9.js +1 -0
- package/public/assets/6231.c10ba8f9.js +1 -0
- package/public/assets/6254.69f98e64.js +1 -0
- package/public/assets/6308.9f7b0778.js +1 -0
- package/public/assets/6309.fd92f229.js +1 -0
- package/public/assets/6378.d0087d79.js +1 -0
- package/public/assets/6380.6a320a57.js +1 -0
- package/public/assets/6427.80120ca0.js +1 -0
- package/public/assets/6468.cd796686.js +1 -0
- package/public/assets/655.2424b6f0.js +1 -0
- package/public/assets/6551.1316a8b4.js +1 -0
- package/public/assets/6563.f0ab8ea9.js +1 -0
- package/public/assets/658.d1870bbc.js +1 -0
- package/public/assets/659.43d1bd18.js +1 -0
- package/public/assets/6629.d5835f7b.js +1 -0
- package/public/assets/670.cc579966.js +1 -0
- package/public/assets/6729.711b6a33.js +1 -0
- package/public/assets/6739.5df85504.js +1 -0
- package/public/assets/6766.b3b93d6b.js +1 -0
- package/public/assets/6781.8330074c.js +1 -0
- package/public/assets/6829.f83cf943.js +1 -0
- package/public/assets/6855.c3b857c6.js +1 -0
- package/public/assets/6883.55fcdbea.js +1 -0
- package/public/assets/6900.abab0925.js +1 -0
- package/public/assets/6956.8307b311.js +1 -0
- package/public/assets/6959.7c488de5.js +1 -0
- package/public/assets/698.ebc84dc0.js +1 -0
- package/public/assets/7015.a05d0b78.js +1 -0
- package/public/assets/702.98bd9103.js +1 -0
- package/public/assets/703.285f3139.js +1 -0
- package/public/assets/7091.027a641c.js +1 -0
- package/public/assets/7104.9c59e320.js +1 -0
- package/public/assets/7113.0dfbe544.js +1 -0
- package/public/assets/7135.e9ab3841.js +1 -0
- package/public/assets/7143.612c372b.js +1 -0
- package/public/assets/7198.dc23f6fa.js +1 -0
- package/public/assets/7228.5b31dd65.js +1 -0
- package/public/assets/7234.bec30557.js +1 -0
- package/public/assets/7330.b15282a7.js +1 -0
- package/public/assets/7342.6f18177c.js +1 -0
- package/public/assets/7350.e46146b3.js +1 -0
- package/public/assets/7372.863b3f51.js +1 -0
- package/public/assets/7387.78fae2d9.js +1 -0
- package/public/assets/7403.acdec0cd.js +1 -0
- package/public/assets/7404.c90b9555.js +1 -0
- package/public/assets/7454.61df5c53.js +1 -0
- package/public/assets/7459.91247a0c.js +1 -0
- package/public/assets/7620.1317e4da.js +1 -0
- package/public/assets/7655.a8e05941.js +1 -0
- package/public/assets/7662.5c5fd466.js +1 -0
- package/public/assets/7698.68eab02c.js +1 -0
- package/public/assets/7714.6a6656ee.js +1 -0
- package/public/assets/7774.b546561d.js +1 -0
- package/public/assets/7822.264595e9.js +1 -0
- package/public/assets/7827.9a988ed6.js +1 -0
- package/public/assets/7858.565180cd.js +1 -0
- package/public/assets/7880.23c4af6f.js +1 -0
- package/public/assets/7921.796cf6f2.js +1 -0
- package/public/assets/7950.9222be47.js +1 -0
- package/public/assets/7992.1bbe27a2.js +1 -0
- package/public/assets/7993.3e415bcd.js +1 -0
- package/public/assets/8012.1df6c7ba.js +1 -0
- package/public/assets/8014.1618a26d.js +1 -0
- package/public/assets/8095.3b776dc1.js +1 -0
- package/public/assets/8115.01697474.js +1 -0
- package/public/assets/8134.2dbefad3.js +1 -0
- package/public/assets/8173.98e9cda8.js +1 -0
- package/public/assets/8178.4448a8c8.js +1 -0
- package/public/assets/8189.726f5bba.js +1 -0
- package/public/assets/8250.6a31d3db.js +1 -0
- package/public/assets/8252.46abb10d.js +1 -0
- package/public/assets/826.55f3327b.js +1 -0
- package/public/assets/8286.7165c5ae.js +1 -0
- package/public/assets/829.57aaa21f.js +1 -0
- package/public/assets/8295.510e74b2.js +1 -0
- package/public/assets/8306.ffe7fef6.js +1 -0
- package/public/assets/8336.071bb524.js +1 -0
- package/public/assets/8346.cfd200d8.js +1 -0
- package/public/assets/8349.8746a8e4.js +1 -0
- package/public/assets/8375.0bf25482.js +1 -0
- package/public/assets/8387.7849a364.js +1 -0
- package/public/assets/8408.7b3b0706.js +1 -0
- package/public/assets/8423.da4adde4.js +1 -0
- package/public/assets/8437.67cbb62b.js +1 -0
- package/public/assets/8439.4ab411cf.js +1 -0
- package/public/assets/8447.805e1fbb.js +1 -0
- package/public/assets/8481.30bb3786.js +1 -0
- package/public/assets/8531.0e8a1bcd.js +1 -0
- package/public/assets/855.c45d80d8.js +1 -0
- package/public/assets/857.47395203.js +1 -0
- package/public/assets/8601.e90cd434.js +1 -0
- package/public/assets/8671.f9b853f6.js +1 -0
- package/public/assets/8696.2db4dd40.js +1 -0
- package/public/assets/8698.d8c25bfd.js +1 -0
- package/public/assets/8725.2a97b2e0.js +1 -0
- package/public/assets/8767.f7dbaf81.js +1 -0
- package/public/assets/877.0d1df971.js +1 -0
- package/public/assets/8799.b2bc36a0.js +1 -0
- package/public/assets/8805.e166d436.js +1 -0
- package/public/assets/8861.8e37cb89.js +1 -0
- package/public/assets/8943.d35181ef.js +1 -0
- package/public/assets/9020.b1614bfe.js +1 -0
- package/public/assets/9048.8a6be463.js +1 -0
- package/public/assets/9060.f88d7ff2.js +1 -0
- package/public/assets/9109.e2cef4ae.js +1 -0
- package/public/assets/9120.0baa1b3f.js +1 -0
- package/public/assets/9172.9b1d2d6a.js +1 -0
- package/public/assets/920.5f971a4e.js +1 -0
- package/public/assets/9279.7ff451d0.js +1 -0
- package/public/assets/9285.c26079c7.js +1 -0
- package/public/assets/9297.7162de0e.js +1 -0
- package/public/assets/9328.a33ba701.js +1 -0
- package/public/assets/940.5806c487.js +1 -0
- package/public/assets/9403.d4200316.js +1 -0
- package/public/assets/9412.5849ed28.js +1 -0
- package/public/assets/9420.c4e70fab.js +1 -0
- package/public/assets/9467.1a7a6c92.js +1 -0
- package/public/assets/9502.c84dc29b.js +1 -0
- package/public/assets/9556.97e5f142.js +1 -0
- package/public/assets/9557.b10d5e41.js +1 -0
- package/public/assets/9597.c517cbfd.js +1 -0
- package/public/assets/96.fdb82714.js +1 -0
- package/public/assets/9619.35683308.js +1 -0
- package/public/assets/9623.437474fc.js +1 -0
- package/public/assets/9663.1210b76e.js +1 -0
- package/public/assets/9671.40a11985.js +1 -0
- package/public/assets/969.ce9121b3.js +1 -0
- package/public/assets/9695.84356bbf.js +1 -0
- package/public/assets/9728.4f98e0ce.js +1 -0
- package/public/assets/9770.df634bdf.js +1 -0
- package/public/assets/9842.6faee06c.js +1 -0
- package/public/assets/9886.1c62a8ff.js +1 -0
- package/public/assets/9888.e3c97777.js +1 -0
- package/public/assets/9918.7ac5f09c.js +1 -0
- package/public/assets/9927.89711a15.js +1 -0
- package/public/assets/9940.70581af3.js +1 -0
- package/public/assets/9990.cf02a3de.js +1 -0
- package/public/assets/main.9128def8.css +2 -0
- package/public/assets/main.95434834.js +1 -0
- package/public/index.html +1 -1
- package/public/assets/main.2375bf2a.css +0 -2
- package/public/assets/main.bd9d3d5b.js +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@seaveyon/harness-switch)
|
|
4
4
|
|
|
5
|
-
**harness-switch** is a Bun-powered web control plane for managing API profiles on an SSH or headless server. It switches API Base URL, API key, and model profiles for **Claude Code**, **Codex**, **Kimi Code**, **
|
|
5
|
+
**harness-switch** is a Bun-powered web control plane for managing API profiles on an SSH or headless server. It switches API Base URL, API key, and model profiles for **Claude Code**, **Codex**, **Kimi Code**, **Pi**, and **DeepSeek Harness (DSH)**.
|
|
6
6
|
|
|
7
7
|
It is a configuration manager, not an API proxy: it does not route or inspect model traffic.
|
|
8
8
|
|
|
@@ -42,7 +42,7 @@ Activation writes each tool's own configuration file. Nothing depends on you hav
|
|
|
42
42
|
| Claude Code | `~/.claude/settings.json` (`env` block) | replace | Immediately; Claude Code re-reads the file and its `env` values win over inherited shell variables |
|
|
43
43
|
| Codex | `$CODEX_HOME/config.toml`, plus `auth.json` only if you pick that auth mode | replace | Next `codex` start |
|
|
44
44
|
| Kimi Code | `$KIMI_CODE_HOME/config.toml` (`~/.kimi-code`) | additive | Next `kimi` start |
|
|
45
|
-
|
|
|
45
|
+
| Pi | `~/.pi/agent/models.json` and `settings.json` | additive | Next `pi` start |
|
|
46
46
|
| DeepSeek Harness | `$DSH_HOME/settings.yaml` and `.credentials.yaml` (`~/.dsh`) | additive | Hot reload; default applies to new sessions |
|
|
47
47
|
|
|
48
48
|
**Replace mode** means the file holds exactly one provider, so activating replaces it. **Additive mode** means the file holds many providers plus a pointer to the current one, so activating only moves that pointer and leaves providers you wrote by hand alone.
|
|
@@ -52,7 +52,7 @@ Notes on individual harnesses:
|
|
|
52
52
|
- **Claude Code** defaults to `ANTHROPIC_AUTH_TOKEN`, which is what most third-party relays require. Switch the profile to `ANTHROPIC_API_KEY` for the official API.
|
|
53
53
|
- **Codex** defaults to putting the token in `config.toml` as `experimental_bearer_token`. The alternative that writes `auth.json` will overwrite your ChatGPT login cache, so it is opt-in; the previous `auth.json` is captured in a backup first either way.
|
|
54
54
|
- **Kimi Code** (`~/.kimi-code`) is a different product from Kimi CLI (`~/.kimi`), even though both provide a `kimi` command. This project targets Kimi Code, which does not read credentials from the shell at all.
|
|
55
|
-
- **
|
|
55
|
+
- **Pi** (`@earendil-works/pi-coding-agent`) registers a custom provider in `models.json` and points `settings.json` at it via `defaultProvider` / `defaultModel`. The API key must live in that provider entry (or `auth.json`); otherwise Pi shows "No models available" and asks for `/login`. A `--model` flag still overrides the default at runtime.
|
|
56
56
|
- **DeepSeek Harness** registers a custom `llm-pi-ai` provider, stores the API key in its separate credentials document, and updates `agent-default-model`. Existing sessions keep their selected route; newly created sessions use the activated profile.
|
|
57
57
|
|
|
58
58
|
`~/.harness-switch/env.sh` remains as a compatibility layer and only contains variables the corresponding tool genuinely honours. It is needed only when a Codex profile uses the environment-variable auth mode:
|
package/dist/harness-switch.js
CHANGED
|
@@ -9210,7 +9210,7 @@ class EnvironmentService {
|
|
|
9210
9210
|
claude: join2(this.homeDir, ".claude"),
|
|
9211
9211
|
codex: process.env.CODEX_HOME || join2(this.homeDir, ".codex"),
|
|
9212
9212
|
kimiCode: process.env.KIMI_CODE_HOME || join2(this.homeDir, ".kimi-code"),
|
|
9213
|
-
piAgent: process.env.PI_CODING_AGENT_DIR || join2(this.homeDir, ".
|
|
9213
|
+
piAgent: process.env.PI_CODING_AGENT_DIR || join2(this.homeDir, ".pi", "agent"),
|
|
9214
9214
|
dsh: process.env.DSH_HOME || join2(this.homeDir, ".dsh")
|
|
9215
9215
|
};
|
|
9216
9216
|
ensureDataDir() {
|
|
@@ -9574,23 +9574,42 @@ class BackupService {
|
|
|
9574
9574
|
return id;
|
|
9575
9575
|
}
|
|
9576
9576
|
list() {
|
|
9577
|
-
|
|
9577
|
+
const liveCache = new Map;
|
|
9578
|
+
const readLive = (path) => {
|
|
9579
|
+
if (!liveCache.has(path)) {
|
|
9580
|
+
liveCache.set(path, this.files.readOptional(path) ?? null);
|
|
9581
|
+
}
|
|
9582
|
+
return liveCache.get(path) ?? null;
|
|
9583
|
+
};
|
|
9584
|
+
return this.readManifests().map((manifest) => {
|
|
9585
|
+
const dir = join3(this.environment.backupsDir, manifest.id);
|
|
9586
|
+
return {
|
|
9587
|
+
id: manifest.id,
|
|
9588
|
+
createdAt: manifest.createdAt,
|
|
9589
|
+
harness: manifest.harness,
|
|
9590
|
+
profile: manifest.profile,
|
|
9591
|
+
files: manifest.files.map((file) => ({ path: file.path, existed: file.existed })),
|
|
9592
|
+
current: this.matchesLive(dir, manifest.files, readLive)
|
|
9593
|
+
};
|
|
9594
|
+
}).toSorted((left, right) => right.id.localeCompare(left.id));
|
|
9595
|
+
}
|
|
9596
|
+
detail(id) {
|
|
9597
|
+
const { dir, manifest } = this.requireManifest(id);
|
|
9598
|
+
return {
|
|
9578
9599
|
id: manifest.id,
|
|
9579
9600
|
createdAt: manifest.createdAt,
|
|
9580
9601
|
harness: manifest.harness,
|
|
9581
9602
|
profile: manifest.profile,
|
|
9582
|
-
files: manifest.files.map((file) => ({
|
|
9583
|
-
|
|
9603
|
+
files: manifest.files.map((file) => ({
|
|
9604
|
+
path: file.path,
|
|
9605
|
+
existed: file.existed,
|
|
9606
|
+
content: this.storedContent(dir, file),
|
|
9607
|
+
currentContent: this.files.readOptional(file.path) ?? null
|
|
9608
|
+
}))
|
|
9609
|
+
};
|
|
9584
9610
|
}
|
|
9585
9611
|
restore(id) {
|
|
9586
|
-
|
|
9587
|
-
throw new HttpError(400, "invalid backup id");
|
|
9588
|
-
}
|
|
9589
|
-
const dir = join3(this.environment.backupsDir, id);
|
|
9590
|
-
const manifest = this.files.readJson(join3(dir, MANIFEST), null);
|
|
9591
|
-
if (!manifest) {
|
|
9592
|
-
throw new HttpError(404, "backup not found");
|
|
9593
|
-
}
|
|
9612
|
+
const { dir, manifest } = this.requireManifest(id);
|
|
9594
9613
|
for (const file of manifest.files) {
|
|
9595
9614
|
if (!file.existed || !file.stored) {
|
|
9596
9615
|
this.files.remove(file.path);
|
|
@@ -9603,6 +9622,30 @@ class BackupService {
|
|
|
9603
9622
|
this.files.writeUserFile(file.path, content);
|
|
9604
9623
|
}
|
|
9605
9624
|
}
|
|
9625
|
+
requireManifest(id) {
|
|
9626
|
+
if (id.includes("/") || id.includes("\\") || id.includes("..")) {
|
|
9627
|
+
throw new HttpError(400, "invalid backup id");
|
|
9628
|
+
}
|
|
9629
|
+
const dir = join3(this.environment.backupsDir, id);
|
|
9630
|
+
const manifest = this.files.readJson(join3(dir, MANIFEST), null);
|
|
9631
|
+
if (!manifest) {
|
|
9632
|
+
throw new HttpError(404, "backup not found");
|
|
9633
|
+
}
|
|
9634
|
+
return { dir, manifest };
|
|
9635
|
+
}
|
|
9636
|
+
matchesLive(dir, files, readLive) {
|
|
9637
|
+
return files.every((file) => this.storedContent(dir, file) === readLive(file.path));
|
|
9638
|
+
}
|
|
9639
|
+
storedContent(dir, file) {
|
|
9640
|
+
if (!file.existed || !file.stored) {
|
|
9641
|
+
return null;
|
|
9642
|
+
}
|
|
9643
|
+
const content = this.files.readOptional(join3(dir, file.stored));
|
|
9644
|
+
if (content === undefined) {
|
|
9645
|
+
throw new HttpError(500, `backup payload missing for ${file.path}`);
|
|
9646
|
+
}
|
|
9647
|
+
return content;
|
|
9648
|
+
}
|
|
9606
9649
|
readManifests() {
|
|
9607
9650
|
return this.files.listDirectories(this.environment.backupsDir).map((name) => this.files.readJson(join3(this.environment.backupsDir, name, MANIFEST), null)).filter((manifest) => manifest !== null);
|
|
9608
9651
|
}
|
|
@@ -9636,6 +9679,7 @@ function createBackupRoutes(services) {
|
|
|
9636
9679
|
const app = new Hono2;
|
|
9637
9680
|
const backups = services.get(IBackupService);
|
|
9638
9681
|
app.get("/", (c) => c.json({ items: backups.list() }));
|
|
9682
|
+
app.get("/:id", (c) => c.json(backups.detail(decodeURIComponent(c.req.param("id")))));
|
|
9639
9683
|
app.post("/:id/restore", (c) => {
|
|
9640
9684
|
backups.restore(decodeURIComponent(c.req.param("id")));
|
|
9641
9685
|
return c.json({ ok: true });
|
|
@@ -11527,7 +11571,7 @@ class KimiAdapter {
|
|
|
11527
11571
|
// src/services/adapters/pi.ts
|
|
11528
11572
|
import { join as join8 } from "path";
|
|
11529
11573
|
var MODELS = "models";
|
|
11530
|
-
var
|
|
11574
|
+
var SETTINGS3 = "settings";
|
|
11531
11575
|
var DEFAULT_CONTEXT3 = 200000;
|
|
11532
11576
|
var DEFAULT_MAX_TOKENS2 = 8192;
|
|
11533
11577
|
|
|
@@ -11536,7 +11580,7 @@ class PiAdapter {
|
|
|
11536
11580
|
id = "pi";
|
|
11537
11581
|
mode = "additive";
|
|
11538
11582
|
envVarNames = [];
|
|
11539
|
-
envNote = "API key \u76F4\u63A5\u5199\u5165 models.
|
|
11583
|
+
envNote = "API key \u76F4\u63A5\u5199\u5165 models.json\uFF0C\u65E0\u9700\u73AF\u5883\u53D8\u91CF\uFF1B\u8FD0\u884C\u65F6\u4ECD\u53EF\u7528 --model \u8986\u76D6\u3002";
|
|
11540
11584
|
fields = [
|
|
11541
11585
|
{
|
|
11542
11586
|
key: "providerId",
|
|
@@ -11552,7 +11596,8 @@ class PiAdapter {
|
|
|
11552
11596
|
defaultValue: "openai-completions",
|
|
11553
11597
|
options: [
|
|
11554
11598
|
{ value: "openai-completions", label: "openai-completions" },
|
|
11555
|
-
{ value: "openai-responses", label: "openai-responses" }
|
|
11599
|
+
{ value: "openai-responses", label: "openai-responses" },
|
|
11600
|
+
{ value: "anthropic-messages", label: "anthropic-messages" }
|
|
11556
11601
|
]
|
|
11557
11602
|
},
|
|
11558
11603
|
{
|
|
@@ -11577,6 +11622,17 @@ class PiAdapter {
|
|
|
11577
11622
|
label: "\u6700\u5927\u8F93\u51FA tokens",
|
|
11578
11623
|
kind: "text",
|
|
11579
11624
|
defaultValue: String(DEFAULT_MAX_TOKENS2)
|
|
11625
|
+
},
|
|
11626
|
+
{
|
|
11627
|
+
key: "reasoning",
|
|
11628
|
+
label: "\u63A8\u7406\u80FD\u529B",
|
|
11629
|
+
kind: "select",
|
|
11630
|
+
defaultValue: "false",
|
|
11631
|
+
help: "\u5BF9\u5E94 models.json \u7684 reasoning\u3002GPT / Claude \u601D\u8003\u6A21\u578B\u9700\u8981\u5F00\u542F\u3002",
|
|
11632
|
+
options: [
|
|
11633
|
+
{ value: "false", label: "\u5173\u95ED" },
|
|
11634
|
+
{ value: "true", label: "\u5F00\u542F" }
|
|
11635
|
+
]
|
|
11580
11636
|
}
|
|
11581
11637
|
];
|
|
11582
11638
|
constructor(environment) {
|
|
@@ -11586,15 +11642,15 @@ class PiAdapter {
|
|
|
11586
11642
|
return [
|
|
11587
11643
|
{
|
|
11588
11644
|
key: MODELS,
|
|
11589
|
-
label: "models.
|
|
11590
|
-
path: join8(this.environment.harnessHomes.piAgent, "models.
|
|
11591
|
-
format: "
|
|
11645
|
+
label: "models.json",
|
|
11646
|
+
path: join8(this.environment.harnessHomes.piAgent, "models.json"),
|
|
11647
|
+
format: "json"
|
|
11592
11648
|
},
|
|
11593
11649
|
{
|
|
11594
|
-
key:
|
|
11595
|
-
label: "
|
|
11596
|
-
path: join8(this.environment.harnessHomes.piAgent, "
|
|
11597
|
-
format: "
|
|
11650
|
+
key: SETTINGS3,
|
|
11651
|
+
label: "settings.json",
|
|
11652
|
+
path: join8(this.environment.harnessHomes.piAgent, "settings.json"),
|
|
11653
|
+
format: "json"
|
|
11598
11654
|
}
|
|
11599
11655
|
];
|
|
11600
11656
|
}
|
|
@@ -11603,30 +11659,37 @@ class PiAdapter {
|
|
|
11603
11659
|
}
|
|
11604
11660
|
validate(profile) {
|
|
11605
11661
|
if (!profile.model.trim()) {
|
|
11606
|
-
throw new HttpError(400, "
|
|
11662
|
+
throw new HttpError(400, "Pi \u9700\u8981\u586B\u5199\u6A21\u578B\u540D\u79F0\uFF0C\u5426\u5219\u65E0\u6CD5\u751F\u6210 models \u6761\u76EE");
|
|
11663
|
+
}
|
|
11664
|
+
if (!profile.apiKey.trim()) {
|
|
11665
|
+
throw new HttpError(400, "Pi \u9700\u8981\u586B\u5199 API key\uFF0C\u5426\u5219\u6A21\u578B\u4E0D\u4F1A\u51FA\u73B0\u5728 /model \u5217\u8868\u91CC");
|
|
11607
11666
|
}
|
|
11608
11667
|
}
|
|
11609
11668
|
render(profile, current) {
|
|
11610
11669
|
this.validate(profile);
|
|
11611
11670
|
const id = this.providerId(profile);
|
|
11612
|
-
const models =
|
|
11613
|
-
models
|
|
11614
|
-
|
|
11615
|
-
|
|
11616
|
-
|
|
11617
|
-
|
|
11618
|
-
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
|
|
11622
|
-
|
|
11623
|
-
|
|
11624
|
-
|
|
11625
|
-
|
|
11626
|
-
|
|
11671
|
+
const models = parseJsonObject(current[MODELS]);
|
|
11672
|
+
const provider = ensureObject(ensureObject(models, "providers"), id);
|
|
11673
|
+
const model = {
|
|
11674
|
+
id: profile.model,
|
|
11675
|
+
name: profile.model,
|
|
11676
|
+
contextWindow: this.numeric(profile.extras.contextWindow, DEFAULT_CONTEXT3),
|
|
11677
|
+
maxTokens: this.numeric(profile.extras.maxTokens, DEFAULT_MAX_TOKENS2)
|
|
11678
|
+
};
|
|
11679
|
+
if (profile.extras.reasoning === "true") {
|
|
11680
|
+
model.reasoning = true;
|
|
11681
|
+
}
|
|
11682
|
+
provider.baseUrl = profile.baseUrl;
|
|
11683
|
+
provider.apiKey = profile.apiKey;
|
|
11684
|
+
provider.api = profile.extras.api || "openai-completions";
|
|
11685
|
+
provider.authHeader = profile.extras.authHeader !== "false";
|
|
11686
|
+
provider.models = [model];
|
|
11687
|
+
const settings = parseJsonObject(current[SETTINGS3]);
|
|
11688
|
+
settings.defaultProvider = id;
|
|
11689
|
+
settings.defaultModel = profile.model;
|
|
11627
11690
|
return {
|
|
11628
|
-
[MODELS]: models
|
|
11629
|
-
[
|
|
11691
|
+
[MODELS]: stringifyJson(models),
|
|
11692
|
+
[SETTINGS3]: stringifyJson(settings)
|
|
11630
11693
|
};
|
|
11631
11694
|
}
|
|
11632
11695
|
revoke(profile, current) {
|
|
@@ -11634,34 +11697,48 @@ class PiAdapter {
|
|
|
11634
11697
|
const rendered = {};
|
|
11635
11698
|
if (current[MODELS] !== undefined) {
|
|
11636
11699
|
try {
|
|
11637
|
-
const models =
|
|
11638
|
-
models.
|
|
11639
|
-
|
|
11700
|
+
const models = parseJsonObject(current[MODELS]);
|
|
11701
|
+
const providers = models.providers;
|
|
11702
|
+
if (isPlainObject(providers)) {
|
|
11703
|
+
delete providers[id];
|
|
11704
|
+
}
|
|
11705
|
+
rendered[MODELS] = stringifyJson(models);
|
|
11640
11706
|
} catch {}
|
|
11641
11707
|
}
|
|
11642
|
-
if (current[
|
|
11708
|
+
if (current[SETTINGS3] !== undefined) {
|
|
11643
11709
|
try {
|
|
11644
|
-
const
|
|
11645
|
-
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
} else {
|
|
11649
|
-
config.deleteIn(["modelProviderOrder"]);
|
|
11710
|
+
const settings = parseJsonObject(current[SETTINGS3]);
|
|
11711
|
+
if (settings.defaultProvider === id) {
|
|
11712
|
+
delete settings.defaultProvider;
|
|
11713
|
+
delete settings.defaultModel;
|
|
11650
11714
|
}
|
|
11651
|
-
rendered[
|
|
11715
|
+
rendered[SETTINGS3] = stringifyJson(settings);
|
|
11652
11716
|
} catch {}
|
|
11653
11717
|
}
|
|
11654
11718
|
return rendered;
|
|
11655
11719
|
}
|
|
11656
11720
|
backfill(profile, current) {
|
|
11657
11721
|
try {
|
|
11658
|
-
const models =
|
|
11722
|
+
const models = parseJsonObject(current[MODELS]);
|
|
11659
11723
|
const id = this.providerId(profile);
|
|
11660
|
-
const
|
|
11661
|
-
const
|
|
11724
|
+
const providers = models.providers;
|
|
11725
|
+
const provider = isPlainObject(providers) ? providers[id] : undefined;
|
|
11726
|
+
if (!isPlainObject(provider)) {
|
|
11727
|
+
return {};
|
|
11728
|
+
}
|
|
11729
|
+
const firstModel = Array.isArray(provider.models) ? provider.models.find((entry) => isPlainObject(entry)) : undefined;
|
|
11730
|
+
const apiKey = readString(provider, "apiKey");
|
|
11662
11731
|
return {
|
|
11663
|
-
baseUrl:
|
|
11664
|
-
apiKey:
|
|
11732
|
+
baseUrl: readString(provider, "baseUrl") || profile.baseUrl,
|
|
11733
|
+
apiKey: apiKey || profile.apiKey,
|
|
11734
|
+
model: readString(firstModel, "id") || profile.model,
|
|
11735
|
+
extras: {
|
|
11736
|
+
...profile.extras,
|
|
11737
|
+
api: readString(provider, "api") || profile.extras.api || "",
|
|
11738
|
+
contextWindow: valueString2(firstModel?.contextWindow, profile.extras.contextWindow),
|
|
11739
|
+
maxTokens: valueString2(firstModel?.maxTokens, profile.extras.maxTokens),
|
|
11740
|
+
reasoning: firstModel?.reasoning === true ? "true" : profile.extras.reasoning || "false"
|
|
11741
|
+
}
|
|
11665
11742
|
};
|
|
11666
11743
|
} catch {
|
|
11667
11744
|
return {};
|
|
@@ -11670,20 +11747,13 @@ class PiAdapter {
|
|
|
11670
11747
|
providerId(profile) {
|
|
11671
11748
|
return slugify(profile.extras.providerId || profile.name, "provider");
|
|
11672
11749
|
}
|
|
11673
|
-
promote(existing, id) {
|
|
11674
|
-
return [id, ...this.toStringArray(existing).filter((entry) => entry !== id)];
|
|
11675
|
-
}
|
|
11676
|
-
toStringArray(value) {
|
|
11677
|
-
const plain = isYamlNode2(value) ? value.toJSON() : value;
|
|
11678
|
-
return Array.isArray(plain) ? plain.filter((entry) => typeof entry === "string") : [];
|
|
11679
|
-
}
|
|
11680
11750
|
numeric(raw2, fallback) {
|
|
11681
11751
|
const parsed = Number(raw2);
|
|
11682
11752
|
return Number.isFinite(parsed) && parsed > 0 ? Math.trunc(parsed) : fallback;
|
|
11683
11753
|
}
|
|
11684
11754
|
}
|
|
11685
|
-
function
|
|
11686
|
-
return typeof value === "
|
|
11755
|
+
function valueString2(value, fallback) {
|
|
11756
|
+
return typeof value === "number" && Number.isFinite(value) ? String(value) : fallback || "";
|
|
11687
11757
|
}
|
|
11688
11758
|
|
|
11689
11759
|
// src/services/adapters/index.ts
|
|
@@ -11785,7 +11855,7 @@ var HARNESS_LABELS = {
|
|
|
11785
11855
|
claude: "Claude Code",
|
|
11786
11856
|
codex: "Codex",
|
|
11787
11857
|
kimi: "Kimi Code",
|
|
11788
|
-
pi: "
|
|
11858
|
+
pi: "Pi",
|
|
11789
11859
|
dsh: "DeepSeek Harness"
|
|
11790
11860
|
};
|
|
11791
11861
|
function isHarnessId(value) {
|
|
@@ -12331,6 +12401,7 @@ function createApp(services) {
|
|
|
12331
12401
|
}
|
|
12332
12402
|
const index = join9(publicDir, "index.html");
|
|
12333
12403
|
if (existsSync3(index)) {
|
|
12404
|
+
c.header("Cache-Control", "no-store");
|
|
12334
12405
|
return c.html(await Bun.file(index).text());
|
|
12335
12406
|
}
|
|
12336
12407
|
return c.text("frontend not built", 503);
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seaveyon/harness-switch",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A secure web control plane that switches API providers for Claude Code, Codex, Kimi Code,
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "A secure web control plane that switches API providers for Claude Code, Codex, Kimi Code, Pi and DeepSeek Harness by writing their native config files on SSH servers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
7
7
|
"codex",
|
|
8
8
|
"kimi-code",
|
|
9
|
-
"
|
|
9
|
+
"pi",
|
|
10
|
+
"pi-coding-agent",
|
|
10
11
|
"deepseek-harness",
|
|
11
12
|
"api-key",
|
|
12
13
|
"ssh",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_seaveyon_harness_switch_web=self.webpackChunk_seaveyon_harness_switch_web||[]).push([["1044"],{1215(e,n,t){t.r(n),t.d(n,{default:()=>a});let a=[Object.freeze(JSON.parse('{"displayName":"Shell","name":"shellscript","patterns":[{"include":"#initial_context"}],"repository":{"alias_statement":{"begin":"[\\\\t ]*+(alias)[\\\\t ]*+((?:((?<!\\\\w)-\\\\w+)\\\\b[\\\\t ]*+)*)[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))","beginCaptures":{"1":{"name":"storage.type.alias.shell"},"2":{"patterns":[{"match":"(?<!\\\\w)-\\\\w+\\\\b","name":"string.unquoted.argument.shell constant.other.option.shell"}]},"3":{"name":"string.unquoted.argument.shell constant.other.option.shell"},"4":{"name":"variable.other.assignment.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"variable.other.assignment.shell"},"7":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"8":{"name":"punctuation.definition.array.access.shell"},"9":{"name":"keyword.operator.assignment.shell"},"10":{"name":"keyword.operator.assignment.compound.shell"},"11":{"name":"keyword.operator.assignment.compound.shell"}},"end":"(?=[\\\\t ]|$)|(?:(?:(?:(;)|(&&))|(\\\\|\\\\|))|(&))","endCaptures":{"1":{"name":"punctuation.terminator.statement.semicolon.shell"},"2":{"name":"punctuation.separator.statement.and.shell"},"3":{"name":"punctuation.separator.statement.or.shell"},"4":{"name":"punctuation.separator.statement.background.shell"}},"name":"meta.expression.assignment.alias.shell","patterns":[{"include":"#normal_context"}]},"argument":{"begin":"[\\\\t ]++(?![\\\\n#\\\\&(\\\\[|]|$|;)","beginCaptures":{},"end":"(?=[\\\\t \\\\&;|]|$|[\\\\n)`])","endCaptures":{},"name":"meta.argument.shell","patterns":[{"include":"#argument_context"},{"include":"#line_continuation"}]},"argument_context":{"patterns":[{"captures":{"1":{"name":"string.unquoted.argument.shell","patterns":[{"match":"\\\\*","name":"variable.language.special.wildcard.shell"},{"include":"#variable"},{"include":"#numeric_literal"},{"captures":{"1":{"name":"constant.language.$1.shell"}},"match":"(?<!\\\\w)\\\\b(true|false)\\\\b(?!\\\\w)"}]}},"match":"[\\\\t ]*+([^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\`|]+(?!>))"},{"include":"#normal_context"}]},"arithmetic_double":{"patterns":[{"begin":"\\\\(\\\\(","beginCaptures":{"0":{"name":"punctuation.section.arithmetic.double.shell"}},"end":"\\\\)\\\\s*\\\\)","endCaptures":{"0":{"name":"punctuation.section.arithmetic.double.shell"}},"name":"meta.arithmetic.shell","patterns":[{"include":"#math"},{"include":"#string"}]}]},"arithmetic_no_dollar":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.section.arithmetic.single.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.section.arithmetic.single.shell"}},"name":"meta.arithmetic.shell","patterns":[{"include":"#math"},{"include":"#string"}]}]},"array_access_inline":{"captures":{"1":{"name":"punctuation.section.array.shell"},"2":{"patterns":[{"include":"#special_expansion"},{"include":"#string"},{"include":"#variable"}]},"3":{"name":"punctuation.section.array.shell"}},"match":"(\\\\[)([^]\\\\[]+)(])"},"array_value":{"begin":"[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))[\\\\t ]*+(\\\\()","beginCaptures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"},"9":{"name":"punctuation.definition.array.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.array.shell"}},"patterns":[{"include":"#comment"},{"captures":{"1":{"name":"variable.other.assignment.array.shell entity.other.attribute-name.shell"},"2":{"name":"keyword.operator.assignment.shell punctuation.definition.assignment.shell"}},"match":"((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(=)"},{"captures":{"1":{"name":"punctuation.definition.bracket.named-array.shell"},"2":{"name":"string.unquoted.shell entity.other.attribute-name.bracket.shell"},"3":{"name":"punctuation.definition.bracket.named-array.shell"},"4":{"name":"punctuation.definition.assignment.shell"}},"match":"(\\\\[)(.+?)(])(=)"},{"include":"#normal_context"},{"include":"#simple_unquoted"}]},"assignment_statement":{"patterns":[{"include":"#array_value"},{"include":"#modified_assignment_statement"},{"include":"#normal_assignment_statement"}]},"basic_command_name":{"captures":{"1":{"name":"storage.modifier.$1.shell"},"2":{"name":"entity.name.function.call.shell entity.name.command.shell","patterns":[{"match":"(?<!\\\\w)(?:continue|return|break)(?!\\\\w)","name":"keyword.control.$0.shell"},{"match":"(?<!\\\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|[.:])(?!/)(?!\\\\w)(?!-)","name":"support.function.builtin.shell"},{"include":"#variable"}]}},"match":"(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?:((?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$))|((?![\\"\']|\\\\\\\\\\\\n?$)[^\\\\t\\\\n\\\\r !\\"\'<>]+?))(?:(?=[\\\\t ])|(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\))","name":"meta.statement.command.name.basic.shell"},"block_comment":{"begin":"\\\\s*+(/\\\\*)","beginCaptures":{"1":{"name":"punctuation.definition.comment.begin.shell"}},"end":"\\\\*/","endCaptures":{"0":{"name":"punctuation.definition.comment.end.shell"}},"name":"comment.block.shell"},"boolean":{"match":"\\\\b(?:true|false)\\\\b","name":"constant.language.$0.shell"},"case_statement":{"begin":"\\\\b(case)\\\\b[\\\\t ]*+(.+?)[\\\\t ]*+\\\\b(in)\\\\b","beginCaptures":{"1":{"name":"keyword.control.case.shell"},"2":{"patterns":[{"include":"#initial_context"}]},"3":{"name":"keyword.control.in.shell"}},"end":"\\\\besac\\\\b","endCaptures":{"0":{"name":"keyword.control.esac.shell"}},"name":"meta.case.shell","patterns":[{"include":"#comment"},{"captures":{"1":{"name":"keyword.operator.pattern.case.default.shell"}},"match":"[\\\\t ]*+(\\\\* *\\\\))"},{"begin":"(?<!\\\\))(?![\\\\t ]*+(?:esac\\\\b|$))","beginCaptures":{},"end":"(?=\\\\besac\\\\b)|(\\\\))","endCaptures":{"1":{"name":"keyword.operator.pattern.case.shell"}},"name":"meta.case.entry.pattern.shell","patterns":[{"include":"#case_statement_context"}]},{"begin":"(?<=\\\\))","beginCaptures":{},"end":"(;;)|(?=\\\\besac\\\\b)","endCaptures":{"1":{"name":"punctuation.terminator.statement.case.shell"}},"name":"meta.case.entry.body.shell","patterns":[{"include":"#typical_statements"},{"include":"#initial_context"}]}]},"case_statement_context":{"patterns":[{"match":"\\\\*","name":"variable.language.special.quantifier.star.shell keyword.operator.quantifier.star.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"\\\\+","name":"variable.language.special.quantifier.plus.shell keyword.operator.quantifier.plus.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"\\\\?","name":"variable.language.special.quantifier.question.shell keyword.operator.quantifier.question.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"},{"match":"@","name":"variable.language.special.at.shell keyword.operator.at.shell punctuation.definition.regex.at.shell"},{"match":"\\\\|","name":"keyword.operator.orvariable.language.special.or.shell keyword.operator.alternation.ruby.shell punctuation.definition.regex.alternation.shell punctuation.separator.regex.alternation.shell"},{"match":"\\\\\\\\.","name":"constant.character.escape.shell"},{"match":"(?<=\\\\tin| in|[\\\\t ]|;;)\\\\(","name":"keyword.operator.pattern.case.shell"},{"begin":"(?<=\\\\S)(\\\\()","beginCaptures":{"1":{"name":"punctuation.definition.group.shell punctuation.definition.regex.group.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.definition.regex.group.shell"}},"name":"meta.parenthese.shell","patterns":[{"include":"#case_statement_context"}]},{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.character-class.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.character-class.shell"}},"name":"string.regexp.character-class.shell","patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.shell"}]},{"include":"#string"},{"match":"[^\\\\t\\\\n )*?@\\\\[|]","name":"string.unquoted.pattern.shell string.regexp.unquoted.shell"}]},"command_name_range":{"begin":"\\\\G","beginCaptures":{},"end":"(?=[\\\\t \\\\&;|]|$|[\\\\n)`])|(?=<)","endCaptures":{},"name":"meta.statement.command.name.shell","patterns":[{"match":"(?<!\\\\w)(?:continue|return|break)(?!\\\\w)","name":"entity.name.function.call.shell entity.name.command.shell keyword.control.$0.shell"},{"match":"(?<!\\\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|[.:])(?!/)(?!\\\\w)(?!-)","name":"entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell"},{"include":"#variable"},{"captures":{"1":{"name":"entity.name.function.call.shell entity.name.command.shell"}},"match":"(?<!\\\\w)(?<=\\\\G|[\\"\')}])([^\\\\t\\\\n\\\\r \\"\\\\&\');->`{|]+)"},{"begin":"(?:\\\\G|(?<![\\\\t\\\\n #\\\\&;{|]))(\\\\$?)((\\")|(\'))","beginCaptures":{"1":{"name":"meta.statement.command.name.quoted.shell punctuation.definition.string.shell entity.name.function.call.shell entity.name.command.shell"},"2":{},"3":{"name":"meta.statement.command.name.quoted.shell string.quoted.double.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"},"4":{"name":"meta.statement.command.name.quoted.shell string.quoted.single.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"}},"end":"(?<!\\\\G)(?<=\\\\2)","endCaptures":{},"patterns":[{"include":"#continuation_of_single_quoted_command_name"},{"include":"#continuation_of_double_quoted_command_name"}]},{"include":"#line_continuation"},{"include":"#simple_unquoted"}]},"command_statement":{"begin":"[\\\\t ]*+(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?!\\\\\\\\\\\\n?$)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.command.shell","patterns":[{"include":"#command_name_range"},{"include":"#line_continuation"},{"include":"#option"},{"include":"#argument"},{"include":"#string"},{"include":"#heredoc"}]},"comment":{"captures":{"1":{"name":"comment.line.number-sign.shell meta.shebang.shell"},"2":{"name":"punctuation.definition.comment.shebang.shell"},"3":{"name":"comment.line.number-sign.shell"},"4":{"name":"punctuation.definition.comment.shell"}},"match":"(?:^|[\\\\t ]++)(?:((#!).*)|((#).*))"},"comments":{"patterns":[{"include":"#block_comment"},{"include":"#line_comment"}]},"compound-command":{"patterns":[{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical-expression"},{"include":"#initial_context"}]},{"begin":"(?<=\\\\s|^)\\\\{(?=\\\\s|$)","beginCaptures":{"0":{"name":"punctuation.definition.group.shell"}},"end":"(?<=^|;)\\\\s*(})","endCaptures":{"1":{"name":"punctuation.definition.group.shell"}},"name":"meta.scope.group.shell","patterns":[{"include":"#initial_context"}]}]},"continuation_of_double_quoted_command_name":{"begin":"\\\\G(?<=\\")","beginCaptures":{},"contentName":"meta.statement.command.name.continuation string.quoted.double entity.name.function.call entity.name.command","end":"\\"","endCaptures":{"0":{"name":"string.quoted.double.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"}},"patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},"continuation_of_single_quoted_command_name":{"begin":"\\\\G(?<=\')","beginCaptures":{},"contentName":"meta.statement.command.name.continuation string.quoted.single entity.name.function.call entity.name.command","end":"\'","endCaptures":{"0":{"name":"string.quoted.single.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"}}},"custom_command_names":{"patterns":[]},"custom_commands":{"patterns":[]},"double_quote_context":{"patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},"double_quote_escape_char":{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},"floating_keyword":{"patterns":[{"match":"(?<=^|[\\\\t \\\\&;])(?:then|elif|else|done|end|do|if|fi)(?=[\\\\t \\\\&;]|$)","name":"keyword.control.$0.shell"}]},"for_statement":{"patterns":[{"begin":"\\\\b(for)\\\\b[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))[\\\\t ]*+\\\\b(in)\\\\b","beginCaptures":{"1":{"name":"keyword.control.for.shell"},"2":{"name":"variable.other.for.shell"},"3":{"name":"keyword.control.in.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.for.in.shell","patterns":[{"include":"#string"},{"include":"#simple_unquoted"},{"include":"#normal_context"}]},{"begin":"\\\\b(for)\\\\b","beginCaptures":{"1":{"name":"keyword.control.for.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.for.shell","patterns":[{"include":"#arithmetic_double"},{"include":"#normal_context"}]}]},"function_definition":{"applyEndPatternLast":1,"begin":"[\\\\t ]*+(?:\\\\b(function)\\\\b[\\\\t ]*+([^\\\\t\\\\n\\\\r \\"\'()=]+)(?:(\\\\()[\\\\t ]*+(\\\\)))?|([^\\\\t\\\\n\\\\r \\"\'()=]+)[\\\\t ]*+(\\\\()[\\\\t ]*+(\\\\)))","beginCaptures":{"1":{"name":"storage.type.function.shell"},"2":{"name":"entity.name.function.shell"},"3":{"name":"punctuation.definition.arguments.shell"},"4":{"name":"punctuation.definition.arguments.shell"},"5":{"name":"entity.name.function.shell"},"6":{"name":"punctuation.definition.arguments.shell"},"7":{"name":"punctuation.definition.arguments.shell"}},"end":"(?<=[)}])","endCaptures":{},"name":"meta.function.shell","patterns":[{"match":"\\\\G[\\\\t\\\\n ]"},{"begin":"\\\\{","beginCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"name":"meta.function.body.shell","patterns":[{"include":"#initial_context"}]},{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.group.shell punctuation.section.function.definition.shell"}},"name":"meta.function.body.shell","patterns":[{"include":"#initial_context"}]},{"include":"#initial_context"}]},"heredoc":{"patterns":[{"begin":"((?<!<)<<-)[\\\\t ]*+([\\"\'])[\\\\t ]*+([^\\"\']+?)(?=[\\"\\\\&\';<\\\\s])(\\\\2)(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.quote.shell"},"3":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"4":{"name":"punctuation.definition.string.heredoc.quote.shell"},"5":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.quoted.heredoc.indent.$3","end":"^\\\\t*\\\\3(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.$0.shell"}},"patterns":[]},{"begin":"((?<!<)<<(?!<))[\\\\t ]*+([\\"\'])[\\\\t ]*+([^\\"\']+?)(?=[\\"\\\\&\';<\\\\s])(\\\\2)(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.quote.shell"},"3":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"4":{"name":"punctuation.definition.string.heredoc.quote.shell"},"5":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.quoted.heredoc.no-indent.$3","end":"^\\\\3(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[]},{"begin":"((?<!<)<<-)[\\\\t ]*+([^\\\\t \\"\']+)(?=[\\"\\\\&\';<\\\\s])(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"3":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.unquoted.heredoc.indent.$2","end":"^\\\\t*\\\\2(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[{"include":"#double_quote_escape_char"},{"include":"#variable"},{"include":"#interpolation"}]},{"begin":"((?<!<)<<(?!<))[\\\\t ]*+([^\\\\t \\"\']+)(?=[\\"\\\\&\';<\\\\s])(.*)","beginCaptures":{"1":{"name":"keyword.operator.heredoc.shell"},"2":{"name":"punctuation.definition.string.heredoc.delimiter.shell"},"3":{"patterns":[{"include":"#redirect_fix"},{"include":"#typical_statements"}]}},"contentName":"string.unquoted.heredoc.no-indent.$2","end":"^\\\\2(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"punctuation.definition.string.heredoc.delimiter.shell"}},"patterns":[{"include":"#double_quote_escape_char"},{"include":"#variable"},{"include":"#interpolation"}]}]},"herestring":{"patterns":[{"begin":"(<<<)\\\\s*((\'))","beginCaptures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.quoted.single.shell"},"3":{"name":"punctuation.definition.string.begin.shell"}},"contentName":"string.quoted.single.shell","end":"(\')","endCaptures":{"0":{"name":"string.quoted.single.shell"},"1":{"name":"punctuation.definition.string.end.shell"}},"name":"meta.herestring.shell"},{"begin":"(<<<)\\\\s*((\\"))","beginCaptures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.quoted.double.shell"},"3":{"name":"punctuation.definition.string.begin.shell"}},"contentName":"string.quoted.double.shell","end":"(\\")","endCaptures":{"0":{"name":"string.quoted.double.shell"},"1":{"name":"punctuation.definition.string.end.shell"}},"name":"meta.herestring.shell","patterns":[{"include":"#double_quote_context"}]},{"captures":{"1":{"name":"keyword.operator.herestring.shell"},"2":{"name":"string.unquoted.herestring.shell","patterns":[{"include":"#initial_context"}]}},"match":"(<<<)\\\\s*(([^)\\\\\\\\\\\\s]|\\\\\\\\.)+)","name":"meta.herestring.shell"}]},"initial_context":{"patterns":[{"include":"#comment"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#logical_expression_double"},{"include":"#logical_expression_single"},{"include":"#assignment_statement"},{"include":"#case_statement"},{"include":"#for_statement"},{"include":"#loop"},{"include":"#function_definition"},{"include":"#line_continuation"},{"include":"#arithmetic_double"},{"include":"#misc_ranges"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#alias_statement"},{"include":"#normal_statement"},{"include":"#string"},{"include":"#support"}]},"inline_comment":{"captures":{"1":{"name":"comment.block.shell punctuation.definition.comment.begin.shell"},"2":{"name":"comment.block.shell"},"3":{"patterns":[{"match":"\\\\*/","name":"comment.block.shell punctuation.definition.comment.end.shell"},{"match":"\\\\*","name":"comment.block.shell"}]}},"match":"(/\\\\*)((?:[^*]|\\\\*++[^/])*+(\\\\*++/))"},"interpolation":{"patterns":[{"include":"#arithmetic_dollar"},{"include":"#subshell_dollar"},{"begin":"`","beginCaptures":{"0":{"name":"punctuation.definition.evaluation.backticks.shell"}},"end":"`","endCaptures":{"0":{"name":"punctuation.definition.evaluation.backticks.shell"}},"name":"string.interpolated.backtick.shell","patterns":[{"match":"\\\\\\\\[$\\\\\\\\`]","name":"constant.character.escape.shell"},{"begin":"(?<=\\\\W)(?=#)(?!#\\\\{)","beginCaptures":{"1":{"name":"punctuation.whitespace.comment.leading.shell"}},"end":"(?!\\\\G)","patterns":[{"begin":"#","beginCaptures":{"0":{"name":"punctuation.definition.comment.shell"}},"end":"(?=`)","name":"comment.line.number-sign.shell"}]},{"include":"#initial_context"}]}]},"keyword":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])(then|else|elif|fi|for|in|do|done|select|continue|esac|while|until|return)(?=[\\\\&;\\\\s]|$)","name":"keyword.control.shell"},{"match":"(?<=^|[\\\\&;\\\\s])(?:export|declare|typeset|local|readonly)(?=[\\\\&;\\\\s]|$)","name":"storage.modifier.shell"}]},"line_comment":{"begin":"\\\\s*+(//)","beginCaptures":{"1":{"name":"punctuation.definition.comment.shell"}},"end":"(?<=\\\\n)(?<!\\\\\\\\\\\\n)","endCaptures":{},"name":"comment.line.double-slash.shell","patterns":[{"include":"#line_continuation_character"}]},"line_continuation":{"match":"\\\\\\\\(?=\\\\n)","name":"constant.character.escape.line-continuation.shell"},"logical-expression":{"patterns":[{"include":"#arithmetic_no_dollar"},{"match":"=[=~]?|!=?|[<>]|&&|\\\\|\\\\|","name":"keyword.operator.logical.shell"},{"match":"(?<!\\\\S)-(nt|ot|ef|eq|ne|l[et]|g[et]|[GLNOSa-hknopr-uwxz])\\\\b","name":"keyword.operator.logical.shell"}]},"logical_expression_context":{"patterns":[{"include":"#regex_comparison"},{"include":"#arithmetic_no_dollar"},{"include":"#logical-expression"},{"include":"#logical_expression_single"},{"include":"#logical_expression_double"},{"include":"#comment"},{"include":"#boolean"},{"include":"#redirect_number"},{"include":"#numeric_literal"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"}]},"logical_expression_double":{"begin":"\\\\[\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical_expression_context"}]},"logical_expression_single":{"begin":"\\\\[","beginCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"end":"]","endCaptures":{"0":{"name":"punctuation.definition.logical-expression.shell"}},"name":"meta.scope.logical-expression.shell","patterns":[{"include":"#logical_expression_context"}]},"loop":{"patterns":[{"begin":"(?<=^|[\\\\&;\\\\s])(for)\\\\s+(.+?)\\\\s+(in)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"},"2":{"name":"variable.other.loop.shell","patterns":[{"include":"#string"}]},"3":{"name":"keyword.control.shell"}},"end":"(?<=^|[\\\\&;\\\\s])done(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"0":{"name":"keyword.control.shell"}},"name":"meta.scope.for-in-loop.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])(while|until)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"}},"end":"(?<=^|[\\\\&;\\\\s])done(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"0":{"name":"keyword.control.shell"}},"name":"meta.scope.while-loop.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])(select)\\\\s+((?:[^\\\\\\\\\\\\s]|\\\\\\\\.)+)(?=[\\\\&;\\\\s]|$)","beginCaptures":{"1":{"name":"keyword.control.shell"},"2":{"name":"variable.other.loop.shell"}},"end":"(?<=^|[\\\\&;\\\\s])(done)(?=[\\\\&;\\\\s]|$|\\\\))","endCaptures":{"1":{"name":"keyword.control.shell"}},"name":"meta.scope.select-block.shell","patterns":[{"include":"#initial_context"}]},{"begin":"(?<=^|[\\\\&;\\\\s])if(?=[\\\\&;\\\\s]|$)","beginCaptures":{"0":{"name":"keyword.control.if.shell"}},"end":"(?<=^|[\\\\&;\\\\s])fi(?=[\\\\&;\\\\s]|$)","endCaptures":{"0":{"name":"keyword.control.fi.shell"}},"name":"meta.scope.if-block.shell","patterns":[{"include":"#initial_context"}]}]},"math":{"patterns":[{"include":"#variable"},{"match":"\\\\+{1,2}|-{1,2}|[!~]|\\\\*{1,2}|[%/]|<[<=]?|>[=>]?|==|!=|^|\\\\|{1,2}|&{1,2}|[,:=?]|[-%\\\\&*+/^|]=|<<=|>>=","name":"keyword.operator.arithmetic.shell"},{"match":"0[Xx]\\\\h+","name":"constant.numeric.hex.shell"},{"match":";","name":"punctuation.separator.semicolon.range"},{"match":"0\\\\d+","name":"constant.numeric.octal.shell"},{"match":"\\\\d{1,2}#[0-9@-Z_a-z]+","name":"constant.numeric.other.shell"},{"match":"\\\\d+","name":"constant.numeric.integer.shell"},{"match":"(?<!\\\\w)[0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"}]},"math_operators":{"patterns":[{"match":"\\\\+{1,2}|-{1,2}|[!~]|\\\\*{1,2}|[%/]|<[<=]?|>[=>]?|==|!=|^|\\\\|{1,2}|&{1,2}|[,:=?]|[-%\\\\&*+/^|]=|<<=|>>=","name":"keyword.operator.arithmetic.shell"},{"match":"0[Xx]\\\\h+","name":"constant.numeric.hex.shell"},{"match":"0\\\\d+","name":"constant.numeric.octal.shell"},{"match":"\\\\d{1,2}#[0-9@-Z_a-z]+","name":"constant.numeric.other.shell"},{"match":"\\\\d+","name":"constant.numeric.integer.shell"}]},"misc_ranges":{"patterns":[{"include":"#logical_expression_single"},{"include":"#logical_expression_double"},{"include":"#subshell_dollar"},{"begin":"(?<![^\\\\t ])(\\\\{)(?![$\\\\w])","beginCaptures":{"1":{"name":"punctuation.definition.group.shell"}},"end":"}","endCaptures":{"0":{"name":"punctuation.definition.group.shell"}},"name":"meta.scope.group.shell","patterns":[{"include":"#initial_context"}]}]},"modified_assignment_statement":{"begin":"(?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$)","beginCaptures":{"0":{"name":"storage.modifier.$0.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.shell meta.expression.assignment.modified.shell","patterns":[{"match":"(?<!\\\\w)-\\\\w+\\\\b","name":"string.unquoted.argument.shell constant.other.option.shell"},{"include":"#array_value"},{"captures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"},"9":{"name":"constant.numeric.shell constant.numeric.hex.shell"},"10":{"name":"constant.numeric.shell constant.numeric.octal.shell"},"11":{"name":"constant.numeric.shell constant.numeric.other.shell"},"12":{"name":"constant.numeric.shell constant.numeric.decimal.shell"},"13":{"name":"constant.numeric.shell constant.numeric.version.shell"},"14":{"name":"constant.numeric.shell constant.numeric.integer.shell"}},"match":"((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))?(?:(?<=[\\\\t =]|^|[(\\\\[{])(?:(?:(?:(?:(?:(0[Xx]\\\\h+)|(0\\\\d+))|(\\\\d{1,2}#[0-9@-Z_a-z]+))|(-?\\\\d+\\\\.\\\\d+))|(-?\\\\d+(?:\\\\.\\\\d+)+))|(-?\\\\d+))(?=[\\\\t ]|$|[);}]))?"},{"include":"#normal_context"}]},"modifiers":{"match":"(?<=^|[\\\\t \\\\&;])(?:readonly|declare|typeset|export|local)(?=[\\\\t \\\\&;]|$)","name":"storage.modifier.$0.shell"},"normal_assignment_statement":{"begin":"[\\\\t ]*+((?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w))(?:(\\\\[)((?:(?:\\\\$?(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)|@)|\\\\*)|(-?\\\\d+))(]))?(?:(?:(=)|(\\\\+=))|(-=))","beginCaptures":{"1":{"name":"variable.other.assignment.shell"},"2":{"name":"punctuation.definition.array.access.shell"},"3":{"name":"variable.other.assignment.shell"},"4":{"name":"constant.numeric.shell constant.numeric.integer.shell"},"5":{"name":"punctuation.definition.array.access.shell"},"6":{"name":"keyword.operator.assignment.shell"},"7":{"name":"keyword.operator.assignment.compound.shell"},"8":{"name":"keyword.operator.assignment.compound.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.expression.assignment.shell","patterns":[{"include":"#comment"},{"include":"#string"},{"include":"#normal_assignment_statement"},{"begin":"(?<=[\\\\t ])(?![\\\\t ]|\\\\w+=)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.command.env.shell","patterns":[{"include":"#command_name_range"},{"include":"#line_continuation"},{"include":"#option"},{"include":"#argument"},{"include":"#string"}]},{"include":"#simple_unquoted"},{"include":"#normal_context"}]},"normal_context":{"patterns":[{"include":"#comment"},{"include":"#pipeline"},{"include":"#normal_statement_seperator"},{"include":"#misc_ranges"},{"include":"#boolean"},{"include":"#redirect_number"},{"include":"#numeric_literal"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"},{"include":"#parenthese"}]},"normal_statement":{"begin":"(?!^[\\\\t ]*+$)(?:(?<=(?:^until| until|\\\\tuntil|^while| while|\\\\twhile|^elif| elif|\\\\telif|^else| else|\\\\telse|^then| then|\\\\tthen|^do| do|\\\\tdo|^if| if|\\\\tif) )|(?<=^|[!\\\\&(;`{|]))[\\\\t ]*+(?!nocorrect\\\\W|nocorrect\\\\$|function\\\\W|function\\\\$|foreach\\\\W|foreach\\\\$|repeat\\\\W|repeat\\\\$|logout\\\\W|logout\\\\$|coproc\\\\W|coproc\\\\$|select\\\\W|select\\\\$|while\\\\W|while\\\\$|pushd\\\\W|pushd\\\\$|until\\\\W|until\\\\$|case\\\\W|case\\\\$|done\\\\W|done\\\\$|elif\\\\W|elif\\\\$|else\\\\W|else\\\\$|esac\\\\W|esac\\\\$|popd\\\\W|popd\\\\$|then\\\\W|then\\\\$|time\\\\W|time\\\\$|for\\\\W|for\\\\$|end\\\\W|end\\\\$|fi\\\\W|fi\\\\$|do\\\\W|do\\\\$|in\\\\W|in\\\\$|if\\\\W|if\\\\$)","beginCaptures":{},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.statement.shell","patterns":[{"include":"#typical_statements"}]},"normal_statement_seperator":{"captures":{"1":{"name":"punctuation.terminator.statement.semicolon.shell"},"2":{"name":"punctuation.separator.statement.and.shell"},"3":{"name":"punctuation.separator.statement.or.shell"},"4":{"name":"punctuation.separator.statement.background.shell"}},"match":"(?:(?:(;)|(&&))|(\\\\|\\\\|))|(&)"},"numeric_literal":{"captures":{"1":{"name":"constant.numeric.shell constant.numeric.hex.shell"},"2":{"name":"constant.numeric.shell constant.numeric.octal.shell"},"3":{"name":"constant.numeric.shell constant.numeric.other.shell"},"4":{"name":"constant.numeric.shell constant.numeric.decimal.shell"},"5":{"name":"constant.numeric.shell constant.numeric.version.shell"},"6":{"name":"constant.numeric.shell constant.numeric.integer.shell"}},"match":"(?<=[\\\\t =]|^|[(\\\\[{])(?:(?:(?:(?:(?:(0[Xx]\\\\h+)|(0\\\\d+))|(\\\\d{1,2}#[0-9@-Z_a-z]+))|(-?\\\\d+\\\\.\\\\d+))|(-?\\\\d+(?:\\\\.\\\\d+)+))|(-?\\\\d+))(?=[\\\\t ]|$|[);}])"},"option":{"begin":"[\\\\t ]++(-)((?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;]))","beginCaptures":{"1":{"name":"string.unquoted.argument.shell constant.other.option.dash.shell"},"2":{"name":"string.unquoted.argument.shell constant.other.option.shell"}},"contentName":"string.unquoted.argument constant.other.option","end":"(?=[\\\\t ])|(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"patterns":[{"include":"#option_context"}]},"option_context":{"patterns":[{"include":"#misc_ranges"},{"include":"#string"},{"include":"#variable"},{"include":"#interpolation"},{"include":"#heredoc"},{"include":"#herestring"},{"include":"#redirection"},{"include":"#pathname"},{"include":"#floating_keyword"},{"include":"#support"}]},"parenthese":{"patterns":[{"begin":"\\\\(","beginCaptures":{"0":{"name":"punctuation.section.parenthese.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.section.parenthese.shell"}},"name":"meta.parenthese.group.shell","patterns":[{"include":"#initial_context"}]}]},"pathname":{"patterns":[{"match":"(?<=[:=\\\\s]|^)~","name":"keyword.operator.tilde.shell"},{"match":"[*?]","name":"keyword.operator.glob.shell"},{"begin":"([!*+?@])(\\\\()","beginCaptures":{"1":{"name":"keyword.operator.extglob.shell"},"2":{"name":"punctuation.definition.extglob.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.extglob.shell"}},"name":"meta.structure.extglob.shell","patterns":[{"include":"#initial_context"}]}]},"pipeline":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])(time)(?=[\\\\&;\\\\s]|$)","name":"keyword.other.shell"},{"match":"[!|]","name":"keyword.operator.pipe.shell"}]},"redirect_fix":{"captures":{"1":{"name":"keyword.operator.redirect.shell"},"2":{"name":"string.unquoted.argument.shell"}},"match":"(>>?)[\\\\t ]*+([^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\`|]+)"},"redirect_number":{"captures":{"1":{"name":"keyword.operator.redirect.stdout.shell"},"2":{"name":"keyword.operator.redirect.stderr.shell"},"3":{"name":"keyword.operator.redirect.$3.shell"}},"match":"(?<=[\\\\t ])(?:(1)|(2)|(\\\\d+))(?=>)"},"redirection":{"patterns":[{"begin":"[<>]\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.interpolated.process-substitution.shell","patterns":[{"include":"#initial_context"}]},{"match":"(?<![<>])(&>|\\\\d*>&\\\\d*|\\\\d*(>>|[<>])|\\\\d*<&|\\\\d*<>)(?![<>])","name":"keyword.operator.redirect.shell"}]},"regex_comparison":{"match":"=~","name":"keyword.operator.logical.regex.shell"},"regexp":{"patterns":[{"match":".+"}]},"simple_options":{"captures":{"0":{"patterns":[{"captures":{"1":{"name":"string.unquoted.argument.shell constant.other.option.dash.shell"},"2":{"name":"string.unquoted.argument.shell constant.other.option.shell"}},"match":"[\\\\t ]++(-)(\\\\w+)"}]}},"match":"(?:[\\\\t ]++-\\\\w+)*"},"simple_unquoted":{"match":"[^\\\\t\\\\n \\"$\\\\&-);<>\\\\\\\\`|]","name":"string.unquoted.shell"},"special_expansion":{"match":"!|:[-=?]?|[*@]|##?|%%|[%/]","name":"keyword.operator.expansion.shell"},"start_of_command":{"match":"[\\\\t ]*+(?![\\\\n!#\\\\&()<>\\\\[{|]|$|[\\\\t ;])(?!nocorrect |nocorrect\\\\t|nocorrect$|readonly |readonly\\\\t|readonly$|function |function\\\\t|function$|foreach |foreach\\\\t|foreach$|coproc |coproc\\\\t|coproc$|logout |logout\\\\t|logout$|export |export\\\\t|export$|select |select\\\\t|select$|repeat |repeat\\\\t|repeat$|pushd |pushd\\\\t|pushd$|until |until\\\\t|until$|while |while\\\\t|while$|local |local\\\\t|local$|case |case\\\\t|case$|done |done\\\\t|done$|elif |elif\\\\t|elif$|else |else\\\\t|else$|esac |esac\\\\t|esac$|popd |popd\\\\t|popd$|then |then\\\\t|then$|time |time\\\\t|time$|for |for\\\\t|for$|end |end\\\\t|end$|fi |fi\\\\t|fi$|do |do\\\\t|do$|in |in\\\\t|in$|if |if\\\\t|if$)(?!\\\\\\\\\\\\n?$)"},"string":{"patterns":[{"match":"\\\\\\\\.","name":"constant.character.escape.shell"},{"begin":"\'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\'","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.single.shell"},{"begin":"\\\\$?\\"","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\\"","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.double.shell","patterns":[{"match":"\\\\\\\\[\\\\n\\"$\\\\\\\\`]","name":"constant.character.escape.shell"},{"include":"#variable"},{"include":"#interpolation"}]},{"begin":"\\\\$\'","beginCaptures":{"0":{"name":"punctuation.definition.string.begin.shell"}},"end":"\'","endCaptures":{"0":{"name":"punctuation.definition.string.end.shell"}},"name":"string.quoted.single.dollar.shell","patterns":[{"match":"\\\\\\\\[\'\\\\\\\\abefnrtv]","name":"constant.character.escape.ansi-c.shell"},{"match":"\\\\\\\\[0-9]{3}\\"","name":"constant.character.escape.octal.shell"},{"match":"\\\\\\\\x\\\\h{2}\\"","name":"constant.character.escape.hex.shell"},{"match":"\\\\\\\\c.\\"","name":"constant.character.escape.control-char.shell"}]}]},"subshell_dollar":{"patterns":[{"begin":"\\\\$\\\\(","beginCaptures":{"0":{"name":"punctuation.definition.subshell.single.shell"}},"end":"\\\\)","endCaptures":{"0":{"name":"punctuation.definition.subshell.single.shell"}},"name":"meta.scope.subshell","patterns":[{"include":"#parenthese"},{"include":"#initial_context"}]}]},"support":{"patterns":[{"match":"(?<=^|[\\\\&;\\\\s])[.:](?=[\\\\&;\\\\s]|$)","name":"support.function.builtin.shell"}]},"typical_statements":{"patterns":[{"include":"#assignment_statement"},{"include":"#case_statement"},{"include":"#for_statement"},{"include":"#while_statement"},{"include":"#function_definition"},{"include":"#command_statement"},{"include":"#line_continuation"},{"include":"#arithmetic_double"},{"include":"#normal_context"}]},"variable":{"patterns":[{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.all.shell"},"2":{"name":"variable.parameter.positional.all.shell"}},"match":"(\\\\$)(@(?!\\\\w))"},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.shell"},"2":{"name":"variable.parameter.positional.shell"}},"match":"(\\\\$)([0-9](?!\\\\w))"},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.language.special.shell"},"2":{"name":"variable.language.special.shell"}},"match":"(\\\\$)([-!#$*0?_](?!\\\\w))"},{"begin":"(\\\\$)(\\\\{)[\\\\t ]*+(?=\\\\d)","beginCaptures":{"1":{"name":"punctuation.definition.variable.shell variable.parameter.positional.shell"},"2":{"name":"punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell"}},"contentName":"meta.parameter-expansion","end":"}","endCaptures":{"0":{"name":"punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell"}},"patterns":[{"include":"#special_expansion"},{"include":"#array_access_inline"},{"match":"[0-9]+","name":"variable.parameter.positional.shell"},{"match":"(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"},{"include":"#variable"},{"include":"#string"}]},{"begin":"(\\\\$)(\\\\{)","beginCaptures":{"1":{"name":"punctuation.definition.variable.shell"},"2":{"name":"punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell"}},"contentName":"meta.parameter-expansion","end":"}","endCaptures":{"0":{"name":"punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell"}},"patterns":[{"include":"#special_expansion"},{"include":"#array_access_inline"},{"match":"(?<!\\\\w)[-0-9A-Z_a-z]+(?!\\\\w)","name":"variable.other.normal.shell"},{"include":"#variable"},{"include":"#string"}]},{"captures":{"1":{"name":"punctuation.definition.variable.shell variable.other.normal.shell"},"2":{"name":"variable.other.normal.shell"}},"match":"(\\\\$)(\\\\w+(?!\\\\w))"}]},"while_statement":{"patterns":[{"begin":"\\\\b(while)\\\\b","beginCaptures":{"1":{"name":"keyword.control.while.shell"}},"end":"(?=[\\\\n\\\\&);`{|}]|[\\\\t ]*#|])(?<!\\\\\\\\)","endCaptures":{},"name":"meta.while.shell","patterns":[{"include":"#line_continuation"},{"include":"#math_operators"},{"include":"#option"},{"include":"#simple_unquoted"},{"include":"#normal_context"},{"include":"#string"}]}]}},"scopeName":"source.shell","aliases":["bash","sh","shell","zsh"]}'))]}}]);
|