@pome-sh/cli 0.42.2 → 0.42.4
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/build-info.json +3 -3
- package/dist/src/cli/main.js +54 -22
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"package": "pome-sh",
|
|
3
|
-
"version": "0.42.
|
|
4
|
-
"git_sha": "
|
|
5
|
-
"build_time": "2026-08-
|
|
3
|
+
"version": "0.42.4",
|
|
4
|
+
"git_sha": "8596587c815472aa76ee5c89ddf025c3ab7dd19a",
|
|
5
|
+
"build_time": "2026-08-30T23:55:15.281Z"
|
|
6
6
|
}
|
package/dist/src/cli/main.js
CHANGED
|
@@ -35,7 +35,7 @@ import { createServer } from 'node:http';
|
|
|
35
35
|
import { createInterface } from 'node:readline';
|
|
36
36
|
import { z } from 'zod';
|
|
37
37
|
import Anthropic from '@anthropic-ai/sdk';
|
|
38
|
-
import {
|
|
38
|
+
import { createRequire } from 'node:module';
|
|
39
39
|
|
|
40
40
|
async function readEventsJsonl(runDir) {
|
|
41
41
|
const file = resolve(runDir, "events.jsonl");
|
|
@@ -710,6 +710,8 @@ async function runDocsCommand(topicArg, opts) {
|
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
712
|
var COMPILER_MODEL = "claude-opus-4-7";
|
|
713
|
+
var MAX_TOKENS = 8192;
|
|
714
|
+
var SEED_JSON_SCHEMA = JSON.stringify(z.toJSONSchema(seedSchema, { io: "input" }));
|
|
713
715
|
var SYSTEM_PROMPT = `You convert natural-language descriptions of a GitHub twin's seed state into JSON matching the provided schema.
|
|
714
716
|
|
|
715
717
|
Rules:
|
|
@@ -721,7 +723,13 @@ Rules:
|
|
|
721
723
|
6. Issue \`number\` is required and must be set (use #N if the prose says so, otherwise start at 1).
|
|
722
724
|
7. PR \`number\` is optional; set it when the prose says "#N".
|
|
723
725
|
8. Issue \`assignees\` is an array of login strings; use [] when unassigned.
|
|
724
|
-
9. Use fenced code blocks in the prose to indicate the exact content of \`files[].content\`. Preserve trailing newlines verbatim
|
|
726
|
+
9. Use fenced code blocks in the prose to indicate the exact content of \`files[].content\`. Preserve trailing newlines verbatim.
|
|
727
|
+
|
|
728
|
+
Respond with a single JSON object that validates against this JSON Schema. Output only the JSON object \u2014 no prose, no markdown fences.
|
|
729
|
+
|
|
730
|
+
<schema>
|
|
731
|
+
${SEED_JSON_SCHEMA}
|
|
732
|
+
</schema>`;
|
|
725
733
|
async function compileSeed(prose, opts = {}) {
|
|
726
734
|
if (!process.env.ANTHROPIC_API_KEY) {
|
|
727
735
|
throw new Error(
|
|
@@ -731,20 +739,26 @@ async function compileSeed(prose, opts = {}) {
|
|
|
731
739
|
const model = opts.model ?? COMPILER_MODEL;
|
|
732
740
|
const client = new Anthropic();
|
|
733
741
|
const t0 = Date.now();
|
|
734
|
-
const response = await client.messages.
|
|
742
|
+
const response = await client.messages.create({
|
|
735
743
|
model,
|
|
736
|
-
max_tokens:
|
|
744
|
+
max_tokens: MAX_TOKENS,
|
|
737
745
|
system: SYSTEM_PROMPT,
|
|
738
|
-
messages: [{ role: "user", content: prose }]
|
|
739
|
-
output_config: { format: zodOutputFormat(seedSchema) }
|
|
746
|
+
messages: [{ role: "user", content: prose }]
|
|
740
747
|
});
|
|
741
748
|
const durationMs = Date.now() - t0;
|
|
742
|
-
if (
|
|
749
|
+
if (response.stop_reason === "max_tokens") {
|
|
743
750
|
throw new Error(
|
|
744
|
-
`Compiler
|
|
751
|
+
`Compiler output was truncated at max_tokens=${MAX_TOKENS}. The seed prose may describe more state than one compile can emit.`
|
|
745
752
|
);
|
|
746
753
|
}
|
|
747
|
-
const
|
|
754
|
+
const text = response.content.map((block) => block.type === "text" ? block.text : "").join("");
|
|
755
|
+
let candidate;
|
|
756
|
+
try {
|
|
757
|
+
candidate = JSON.parse(extractJsonPayload(text));
|
|
758
|
+
} catch (err) {
|
|
759
|
+
throw new Error(`Compiler did not return valid JSON: ${err.message}`);
|
|
760
|
+
}
|
|
761
|
+
const seed = parseGitHubSeedState(candidate);
|
|
748
762
|
return {
|
|
749
763
|
seed,
|
|
750
764
|
inputTokens: response.usage.input_tokens,
|
|
@@ -753,6 +767,11 @@ async function compileSeed(prose, opts = {}) {
|
|
|
753
767
|
durationMs
|
|
754
768
|
};
|
|
755
769
|
}
|
|
770
|
+
function extractJsonPayload(text) {
|
|
771
|
+
const trimmed = text.trim();
|
|
772
|
+
const fenced = trimmed.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/);
|
|
773
|
+
return fenced ? fenced[1] : trimmed;
|
|
774
|
+
}
|
|
756
775
|
|
|
757
776
|
// src/task/seed-verifier.ts
|
|
758
777
|
async function verifySeedWithTwin(seed) {
|
|
@@ -2952,15 +2971,27 @@ function displaySentence(def) {
|
|
|
2952
2971
|
function localDigest(twin) {
|
|
2953
2972
|
return checksDigest(checksFor(twin));
|
|
2954
2973
|
}
|
|
2974
|
+
function bakedVersions() {
|
|
2975
|
+
try {
|
|
2976
|
+
return JSON.parse('{"@pome-sh/sdk":"0.11.6","@pome-sh/wire":"0.4.0","@pome-sh/twin-github":"0.12.0","@pome-sh/twin-gmail":"0.4.0","@pome-sh/twin-linear":"0.4.1","@pome-sh/twin-slack":"0.4.1","@pome-sh/twin-stripe":"0.4.7"}');
|
|
2977
|
+
} catch {
|
|
2978
|
+
return {};
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2955
2981
|
function pinnedVersion(pkg) {
|
|
2956
|
-
const
|
|
2957
|
-
if (
|
|
2982
|
+
const baked = bakedVersions()[pkg];
|
|
2983
|
+
if (baked) return baked;
|
|
2958
2984
|
try {
|
|
2959
|
-
const
|
|
2960
|
-
|
|
2985
|
+
const require2 = createRequire(import.meta.url);
|
|
2986
|
+
const manifest = JSON.parse(readFileSync(require2.resolve(`${pkg}/package.json`), "utf8"));
|
|
2987
|
+
if (manifest.name === pkg && typeof manifest.version === "string") return manifest.version;
|
|
2961
2988
|
} catch {
|
|
2962
|
-
return "unknown";
|
|
2963
2989
|
}
|
|
2990
|
+
return void 0;
|
|
2991
|
+
}
|
|
2992
|
+
function pinLabel(pkg) {
|
|
2993
|
+
const version = pinnedVersion(pkg);
|
|
2994
|
+
return version === void 0 ? pkg : `${pkg} ${version}`;
|
|
2964
2995
|
}
|
|
2965
2996
|
var SUBSTRATE_HELP = {
|
|
2966
2997
|
final: "the final state",
|
|
@@ -2979,6 +3010,10 @@ function bold3(s) {
|
|
|
2979
3010
|
function argFlagsFor(def) {
|
|
2980
3011
|
return templateSlots(def.template).params.map((name) => `--arg ${name}=${def.params[name].example}`).join(" ");
|
|
2981
3012
|
}
|
|
3013
|
+
function checksHeader(twin, count2, version) {
|
|
3014
|
+
const label = bold3(`${twin} \u2014 ${count2} declared check${count2 === 1 ? "" : "s"}`);
|
|
3015
|
+
return version === void 0 ? label : `${label} ${dim3(`(@pome-sh/twin-${twin} ${version})`)}`;
|
|
3016
|
+
}
|
|
2982
3017
|
function jsonView(twin) {
|
|
2983
3018
|
return {
|
|
2984
3019
|
twin,
|
|
@@ -3032,9 +3067,7 @@ async function runChecksCommand(twinArg, opts) {
|
|
|
3032
3067
|
);
|
|
3033
3068
|
return;
|
|
3034
3069
|
}
|
|
3035
|
-
console.log(
|
|
3036
|
-
`${bold3(`${twin} \u2014 ${checks.length} declared check${checks.length === 1 ? "" : "s"}`)} ` + dim3(`(@pome-sh/twin-${twin} ${pinnedVersion(`@pome-sh/twin-${twin}`)})`)
|
|
3037
|
-
);
|
|
3070
|
+
console.log(checksHeader(twin, checks.length, pinnedVersion(`@pome-sh/twin-${twin}`)));
|
|
3038
3071
|
console.log("");
|
|
3039
3072
|
for (const def of checks) {
|
|
3040
3073
|
console.log(` ${bold3(def.id)}`);
|
|
@@ -3325,7 +3358,7 @@ function formatSkewRefusal(twin, findings) {
|
|
|
3325
3358
|
`Refusing to write: this CLI and the cloud disagree about ${twin}'s vocabulary, so a sentence written here might not be graded there.`,
|
|
3326
3359
|
...findings.flatMap(bullet),
|
|
3327
3360
|
"",
|
|
3328
|
-
` local
|
|
3361
|
+
` local ${pinLabel(`@pome-sh/twin-${twin}`)}` + (sdkImplicated ? `, ${pinLabel("@pome-sh/sdk")}` : ""),
|
|
3329
3362
|
...sdkImplicated ? [` The cloud publishes no sdk version here, so that is the only pin this CLI can name.`] : [],
|
|
3330
3363
|
` Update with \`npm i -g @pome-sh/cli@latest\`. If this CLI is already current, the cloud is behind \u2014 that is a deploy, not something you can fix here.`
|
|
3331
3364
|
].join("\n");
|
|
@@ -3350,14 +3383,13 @@ function parseArgFlags(pairs) {
|
|
|
3350
3383
|
return args;
|
|
3351
3384
|
}
|
|
3352
3385
|
async function handshake(twin, fetchRemote) {
|
|
3353
|
-
const pin = pinnedVersion(`@pome-sh/twin-${twin}`);
|
|
3354
3386
|
let remote;
|
|
3355
3387
|
try {
|
|
3356
3388
|
remote = await fetchRemote(twin);
|
|
3357
3389
|
} catch (err) {
|
|
3358
3390
|
return {
|
|
3359
3391
|
kind: "unverified",
|
|
3360
|
-
note: `Not verified against the cloud (${err instanceof Error ? err.message : "unreachable"}). Writing from the local pin:
|
|
3392
|
+
note: `Not verified against the cloud (${err instanceof Error ? err.message : "unreachable"}). Writing from the local pin: ${pinLabel(`@pome-sh/twin-${twin}`)}.`
|
|
3361
3393
|
};
|
|
3362
3394
|
}
|
|
3363
3395
|
if (localDigest(twin) === remote.digest) return { kind: "match" };
|
|
@@ -4604,7 +4636,7 @@ function firstSentence(description) {
|
|
|
4604
4636
|
function resolveExampleRef(env = process.env) {
|
|
4605
4637
|
const override = env.POME_EXAMPLE_REF?.trim();
|
|
4606
4638
|
if (override) return override;
|
|
4607
|
-
const baked = "
|
|
4639
|
+
const baked = "8596587c815472aa76ee5c89ddf025c3ab7dd19a".trim() ;
|
|
4608
4640
|
return FULL_SHA.test(baked) ? baked : "main";
|
|
4609
4641
|
}
|
|
4610
4642
|
function rawUrlFor(example, file, ref) {
|
|
@@ -4967,7 +4999,7 @@ var DEFAULT_AGENT_COMMAND = `node ${DEFAULT_AGENT_FILE}`;
|
|
|
4967
4999
|
var MANIFEST_SCHEMA_URL = "https://pome.sh/schemas/v1/pome.json";
|
|
4968
5000
|
var MAX_UNREADABLE_PATHS_SHOWN = 5;
|
|
4969
5001
|
function readPackageVersion() {
|
|
4970
|
-
if ("0.42.
|
|
5002
|
+
if ("0.42.4".length > 0) return "0.42.4";
|
|
4971
5003
|
try {
|
|
4972
5004
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
4973
5005
|
const candidates = [
|