@astrosheep/square 0.3.12 → 0.3.13
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/codex-plugin/.codex-plugin/plugin.json +1 -1
- package/codex-plugin/hooks/hooks.json +9 -0
- package/dist/activity-feed.d.ts +14 -0
- package/dist/activity-feed.js +5 -5
- package/dist/activity.d.ts +9 -0
- package/dist/activity.js +111 -90
- package/dist/artifact.d.ts +20 -0
- package/dist/artifact.js +10 -29
- package/dist/automatic-session.d.ts +5 -0
- package/dist/automatic-session.js +86 -0
- package/dist/boundary-presentation.d.ts +5 -0
- package/dist/boundary-presentation.js +5 -4
- package/dist/claude-hook.d.ts +9 -0
- package/dist/claude-hook.js +35 -3
- package/dist/cli/context.d.ts +35 -0
- package/dist/cli/context.js +25 -30
- package/dist/cli/harness-command.d.ts +28 -0
- package/dist/cli/harness-command.js +29 -14
- package/dist/cli/maintenance-commands.d.ts +7 -0
- package/dist/cli/maintenance-commands.js +3 -3
- package/dist/cli/meta-commands.d.ts +5 -0
- package/dist/cli/observation-commands.d.ts +20 -0
- package/dist/cli/observation-commands.js +155 -128
- package/dist/cli/program.d.ts +2 -0
- package/dist/cli/program.js +2 -12
- package/dist/cli/registry.d.ts +9 -0
- package/dist/cli/registry.js +1 -2
- package/dist/cli/square-commands.d.ts +34 -0
- package/dist/cli/square-commands.js +81 -74
- package/dist/cmd/notify-once.d.ts +2 -0
- package/dist/codex-hook.d.ts +10 -0
- package/dist/codex-hook.js +35 -3
- package/dist/decisions.d.ts +92 -0
- package/dist/decisions.js +83 -77
- package/dist/delivery-health.d.ts +21 -0
- package/dist/delivery-health.js +40 -34
- package/dist/delivery.d.ts +81 -0
- package/dist/delivery.js +60 -22
- package/dist/file-lock.d.ts +6 -0
- package/dist/harness-claude.d.ts +19 -0
- package/dist/harness-claude.js +8 -3
- package/dist/harness-codex.d.ts +29 -0
- package/dist/harness-codex.js +2 -2
- package/dist/harness-links.d.ts +17 -0
- package/dist/harness-links.js +2 -2
- package/dist/harness-pi.d.ts +11 -0
- package/dist/harness-pi.js +2 -2
- package/dist/harness-stage.d.ts +6 -0
- package/dist/harness.d.ts +20 -0
- package/dist/harness.js +5 -3
- package/dist/help.d.ts +6 -0
- package/dist/help.js +6 -5
- package/dist/identity.d.ts +13 -0
- package/dist/inbox.d.ts +2 -0
- package/dist/inbox.js +15 -19
- package/dist/index.d.ts +13 -0
- package/dist/index.js +31 -69
- package/dist/landing.d.ts +10 -0
- package/dist/landing.js +95 -0
- package/dist/list.d.ts +1 -0
- package/dist/list.js +40 -18
- package/dist/model.d.ts +147 -0
- package/dist/model.js +12 -2
- package/dist/notifications.d.ts +30 -0
- package/dist/notifications.js +75 -91
- package/dist/open-square.d.ts +11 -0
- package/dist/open-square.js +4 -0
- package/dist/participant-identity.d.ts +1 -0
- package/dist/participant-identity.js +3 -0
- package/dist/paseo-connection.d.ts +15 -0
- package/dist/paseo-delivery.d.ts +14 -0
- package/dist/paseo-state.d.ts +11 -0
- package/dist/paseo-timeline.d.ts +16 -0
- package/dist/presence.d.ts +3 -0
- package/dist/presence.js +42 -0
- package/dist/presentation.d.ts +91 -0
- package/dist/presentation.js +33 -29
- package/dist/presented.d.ts +11 -0
- package/dist/registry.d.ts +58 -0
- package/dist/registry.js +36 -3
- package/dist/routes.d.ts +42 -0
- package/dist/runtime.d.ts +45 -0
- package/dist/runtime.js +42 -34
- package/dist/search.d.ts +11 -0
- package/dist/square-core.d.ts +111 -0
- package/dist/square-core.js +7 -0
- package/dist/square-facade.d.ts +86 -0
- package/dist/square-facade.js +1 -0
- package/dist/square-file-adapter.d.ts +18 -0
- package/dist/square-file-adapter.js +70 -0
- package/dist/square-storage.d.ts +20 -0
- package/dist/square-storage.js +171 -0
- package/dist/square-wiring.d.ts +19 -0
- package/dist/square-wiring.js +70 -0
- package/dist/square.d.ts +2 -0
- package/dist/state-cell.d.ts +14 -0
- package/dist/state-cell.js +1 -0
- package/dist/stream.d.ts +3 -0
- package/dist/stream.js +19 -23
- package/dist/time.d.ts +6 -0
- package/dist/views.d.ts +95 -0
- package/dist/views.js +81 -0
- package/dist/wake-attempts.d.ts +39 -0
- package/dist/wake-evidence.d.ts +12 -0
- package/dist/wake-evidence.js +7 -10
- package/dist/wake-port.d.ts +20 -0
- package/dist/wake-sink.d.ts +12 -0
- package/dist/wakes.d.ts +40 -0
- package/dist/wakes.js +62 -0
- package/dist/watch.d.ts +2 -0
- package/dist/watch.js +89 -210
- package/extensions/square-opencode.js +27 -1
- package/extensions/square-pi.js +13 -0
- package/package.json +5 -2
- package/skills/brainstorm/SKILL.md +26 -26
- package/skills/square/.claude-plugin/plugin.json +1 -1
- package/skills/square/SKILL.md +47 -29
- package/skills/square/hooks/hooks.json +9 -0
- package/skills/square-feedback/SKILL.md +2 -2
- package/dist/compact.js +0 -26
- package/dist/square-application.js +0 -193
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type HardCap } from '../model.js';
|
|
2
|
+
export declare const DEFAULT_SQUARE_PATH = ".square/SQUARE.square";
|
|
3
|
+
export interface CommandContext {
|
|
4
|
+
squarePath: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
homeDir: string;
|
|
7
|
+
command: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CommandSpec<Intent = unknown, Result = void> {
|
|
10
|
+
parse(argv: string[], context: CommandContext): Intent;
|
|
11
|
+
execute(intent: Intent, context: CommandContext): Promise<Result> | Result;
|
|
12
|
+
present(result: Result, context: CommandContext): void;
|
|
13
|
+
}
|
|
14
|
+
export declare function readStdinSync(): string;
|
|
15
|
+
export declare function resolveBody(arg: string): string;
|
|
16
|
+
export declare function readPipedBodyFallback(): string | undefined;
|
|
17
|
+
export declare function fail(message: string, exitCode?: number): never;
|
|
18
|
+
export declare function usage(command: string): never;
|
|
19
|
+
export declare function requireValue(args: string[], index: number, flag: string): string;
|
|
20
|
+
export declare function parseDurationMs(value: string, flag: string): number;
|
|
21
|
+
export declare function parsePositiveInteger(value: string, flag: string): number;
|
|
22
|
+
export declare function parseNonNegativeInteger(value: string, flag: string): number;
|
|
23
|
+
export declare function parseHardCap(value: string): HardCap;
|
|
24
|
+
export declare function parseNameList(value: string, flag: string): string[];
|
|
25
|
+
export declare function requireParticipant(name: string | undefined): string;
|
|
26
|
+
export interface ParsedGlobalArgs {
|
|
27
|
+
squarePath: string;
|
|
28
|
+
explicitSquarePath: boolean;
|
|
29
|
+
multipleSquares: boolean;
|
|
30
|
+
name?: string;
|
|
31
|
+
args: string[];
|
|
32
|
+
}
|
|
33
|
+
export declare function parseGlobalArgs(rawArgs: string[]): ParsedGlobalArgs;
|
|
34
|
+
export declare function locationIsRequired(command: string): boolean;
|
|
35
|
+
export declare function defaultContext(command: string, squarePath: string, name?: string): CommandContext;
|
package/dist/cli/context.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { loadSquare } from '../artifact.js';
|
|
5
3
|
import { commandUsageHint } from '../help.js';
|
|
6
4
|
import { parseParticipantList, validateName } from '../model.js';
|
|
5
|
+
import { localParticipantName } from '../registry.js';
|
|
7
6
|
export const DEFAULT_SQUARE_PATH = '.square/SQUARE.square';
|
|
8
7
|
export function readStdinSync() {
|
|
9
8
|
try {
|
|
@@ -88,30 +87,17 @@ export function requireParticipant(name) {
|
|
|
88
87
|
validateName(name);
|
|
89
88
|
return name;
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (!entry.isFile() || !entry.name.endsWith('.square'))
|
|
103
|
-
continue;
|
|
104
|
-
const fullPath = path.join(directory, entry.name);
|
|
105
|
-
try {
|
|
106
|
-
const doc = loadSquare(fullPath);
|
|
107
|
-
candidates.push({ relPath: path.relative(process.cwd(), fullPath), at: doc.acts.at(-1)?.at ?? fs.statSync(fullPath).mtimeMs });
|
|
108
|
-
}
|
|
109
|
-
catch {
|
|
110
|
-
// Unreadable artifacts are not implicit command targets.
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
candidates.sort((a, b) => b.at - a.at);
|
|
114
|
-
return { path: candidates[0]?.relPath ?? DEFAULT_SQUARE_PATH, multiple: candidates.length > 1 };
|
|
90
|
+
const LOCATION_REQUIRED_COMMANDS = new Set(['join', 'catch', 'express', 'done', 'hold', 'resume']);
|
|
91
|
+
function configuredLocation() {
|
|
92
|
+
const value = process.env.SQUARE_LOCATION?.trim();
|
|
93
|
+
return value === '' ? undefined : value;
|
|
94
|
+
}
|
|
95
|
+
function configuredName() {
|
|
96
|
+
const value = process.env.SQUARE_PARTICIPANT_NAME?.trim();
|
|
97
|
+
if (!value)
|
|
98
|
+
return undefined;
|
|
99
|
+
validateName(value);
|
|
100
|
+
return value;
|
|
115
101
|
}
|
|
116
102
|
export function parseGlobalArgs(rawArgs) {
|
|
117
103
|
const args = [...rawArgs];
|
|
@@ -129,14 +115,23 @@ export function parseGlobalArgs(rawArgs) {
|
|
|
129
115
|
index -= 1;
|
|
130
116
|
}
|
|
131
117
|
}
|
|
118
|
+
if (name === undefined)
|
|
119
|
+
name = configuredName();
|
|
132
120
|
if (name !== undefined)
|
|
133
121
|
validateName(name);
|
|
134
122
|
const explicitSquarePath = requestedPath !== undefined;
|
|
135
123
|
const command = args[0];
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
124
|
+
const configured = configuredLocation();
|
|
125
|
+
if (command !== undefined && !['--help', '-h'].includes(command) && locationIsRequired(command) && requestedPath === undefined && configured === undefined) {
|
|
126
|
+
fail(`✕ ${command} needs a square location\n» square ls`);
|
|
127
|
+
}
|
|
128
|
+
const squarePath = requestedPath ?? configured ?? DEFAULT_SQUARE_PATH;
|
|
129
|
+
if (name === undefined && command !== undefined && locationIsRequired(command))
|
|
130
|
+
name = localParticipantName(squarePath);
|
|
131
|
+
return { squarePath, explicitSquarePath: explicitSquarePath || configured !== undefined, multipleSquares: false, name, args };
|
|
132
|
+
}
|
|
133
|
+
export function locationIsRequired(command) {
|
|
134
|
+
return LOCATION_REQUIRED_COMMANDS.has(command);
|
|
140
135
|
}
|
|
141
136
|
export function defaultContext(command, squarePath, name) {
|
|
142
137
|
return { command, squarePath, name, homeDir: os.homedir() };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { executeHarnessTarget, type HarnessAction } from '../harness.js';
|
|
2
|
+
import { type CommandSpec } from './context.js';
|
|
3
|
+
export type HarnessCommandAction = HarnessAction;
|
|
4
|
+
export interface ParsedHarnessCommand {
|
|
5
|
+
target?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ParsedInstallCommand {
|
|
8
|
+
targets: string[];
|
|
9
|
+
all: boolean;
|
|
10
|
+
force: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface HarnessCommandResult {
|
|
13
|
+
lines: string[];
|
|
14
|
+
notes: string[];
|
|
15
|
+
failures: string[];
|
|
16
|
+
}
|
|
17
|
+
type HarnessTargetExecutor = typeof executeHarnessTarget;
|
|
18
|
+
export declare function executeTargetBatch(targets: string[], action: 'install' | 'uninstall', context: {
|
|
19
|
+
homeDir: string;
|
|
20
|
+
squarePath?: string;
|
|
21
|
+
force: boolean;
|
|
22
|
+
}, executeTarget?: HarnessTargetExecutor): Promise<HarnessCommandResult>;
|
|
23
|
+
export declare const installCommand: CommandSpec<ParsedInstallCommand, HarnessCommandResult>;
|
|
24
|
+
export declare const uninstallCommand: CommandSpec<ParsedInstallCommand, HarnessCommandResult>;
|
|
25
|
+
export declare const harnessCommand: CommandSpec<ParsedHarnessCommand, HarnessCommandResult>;
|
|
26
|
+
export declare function formatHarnessResult(result: HarnessCommandResult): string;
|
|
27
|
+
export declare function runHarnessCommand(argv: string[], squarePath?: string): Promise<string>;
|
|
28
|
+
export {};
|
|
@@ -26,24 +26,38 @@ function parseInstall(argv, action) {
|
|
|
26
26
|
throw new Error(`Cannot combine ${action} --all with named targets`);
|
|
27
27
|
return { targets, all, force };
|
|
28
28
|
}
|
|
29
|
+
export async function executeTargetBatch(targets, action, context, executeTarget = executeHarnessTarget) {
|
|
30
|
+
const results = [];
|
|
31
|
+
const failures = [];
|
|
32
|
+
for (const target of targets) {
|
|
33
|
+
try {
|
|
34
|
+
results.push(await executeTarget(target, action, context));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
failures.push(`✕ ${target} ${action} failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
notes: results.flatMap((result) => result.notes),
|
|
42
|
+
lines: results.flatMap((result) => result.lines),
|
|
43
|
+
failures,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
29
46
|
function targetCommand(action) {
|
|
30
47
|
return {
|
|
31
48
|
parse(argv) { return parseInstall(argv, action); },
|
|
32
49
|
async execute(intent, context) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
lines: results.flatMap((result) => result.lines),
|
|
44
|
-
};
|
|
50
|
+
return executeTargetBatch(installTargets(intent, action), action, {
|
|
51
|
+
homeDir: context.homeDir,
|
|
52
|
+
squarePath: context.squarePath,
|
|
53
|
+
force: intent.force,
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
present(result) {
|
|
57
|
+
process.stdout.write(formatHarnessResult(result));
|
|
58
|
+
if (result.failures.length > 0)
|
|
59
|
+
process.exitCode = 1;
|
|
45
60
|
},
|
|
46
|
-
present(result) { process.stdout.write(formatHarnessResult(result)); },
|
|
47
61
|
};
|
|
48
62
|
}
|
|
49
63
|
export const installCommand = targetCommand('install');
|
|
@@ -77,6 +91,7 @@ export const harnessCommand = {
|
|
|
77
91
|
return {
|
|
78
92
|
notes: results.flatMap((result) => result.notes),
|
|
79
93
|
lines: results.flatMap((result) => result.lines),
|
|
94
|
+
failures: [],
|
|
80
95
|
};
|
|
81
96
|
},
|
|
82
97
|
present(result) {
|
|
@@ -84,7 +99,7 @@ export const harnessCommand = {
|
|
|
84
99
|
},
|
|
85
100
|
};
|
|
86
101
|
export function formatHarnessResult(result) {
|
|
87
|
-
return `${[...result.notes, ...result.lines].join('\n')}\n`;
|
|
102
|
+
return `${[...result.notes, ...result.lines, ...result.failures].join('\n')}\n`;
|
|
88
103
|
}
|
|
89
104
|
export function runHarnessCommand(argv, squarePath) {
|
|
90
105
|
const context = { homeDir: os.homedir(), squarePath: squarePath ?? '.square/SQUARE.square', command: 'harness' };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { diagnoseSquareFile } from '../
|
|
1
|
+
import { diagnoseSquareFile } from '../square-storage.js';
|
|
2
2
|
import { renderDoctorClean, renderDoctorUnfixable, withPathOutput } from '../presentation.js';
|
|
3
3
|
import { inSquareCount } from '../runtime.js';
|
|
4
4
|
import { usage } from './context.js';
|
|
@@ -10,7 +10,7 @@ export const doctorCommand = {
|
|
|
10
10
|
},
|
|
11
11
|
execute(_intent, context) {
|
|
12
12
|
const diagnosis = diagnoseSquareFile(context.squarePath);
|
|
13
|
-
if (diagnosis.unfixable !== undefined || diagnosis.
|
|
13
|
+
if (diagnosis.unfixable !== undefined || diagnosis.state === undefined) {
|
|
14
14
|
return {
|
|
15
15
|
output: withPathOutput(context.squarePath, renderDoctorUnfixable(diagnosis.unfixable ?? 'the snapshot could not be decoded')),
|
|
16
16
|
exitCode: 2,
|
|
@@ -18,7 +18,7 @@ export const doctorCommand = {
|
|
|
18
18
|
}
|
|
19
19
|
return {
|
|
20
20
|
output: withPathOutput(context.squarePath, renderDoctorClean(), {
|
|
21
|
-
participantCount: inSquareCount(diagnosis.
|
|
21
|
+
participantCount: inSquareCount(diagnosis.state),
|
|
22
22
|
}),
|
|
23
23
|
};
|
|
24
24
|
},
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ActivitiesOptions, type WatchOptions } from '../model.js';
|
|
2
|
+
import { type CommandSpec } from './context.js';
|
|
3
|
+
export declare const listCommand: CommandSpec<string[]>;
|
|
4
|
+
interface StreamIntent {
|
|
5
|
+
ndjson: boolean;
|
|
6
|
+
forName?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const streamCommand: CommandSpec<StreamIntent>;
|
|
9
|
+
export declare const catchCommand: CommandSpec<WatchOptions>;
|
|
10
|
+
export declare const historyCommand: CommandSpec<ActivitiesOptions, string>;
|
|
11
|
+
export declare const participantsCommand: CommandSpec<undefined, string>;
|
|
12
|
+
export declare const statusCommand: CommandSpec<undefined, string>;
|
|
13
|
+
interface InboxIntent {
|
|
14
|
+
sessionId: string;
|
|
15
|
+
json: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const inboxCommand: CommandSpec<InboxIntent, string>;
|
|
18
|
+
export declare const claudeHookCommand: CommandSpec<undefined, string>;
|
|
19
|
+
export declare const codexHookCommand: CommandSpec<undefined, string>;
|
|
20
|
+
export {};
|